用户消费统计 标题筛选逻辑优化

This commit is contained in:
wule committed 2026-08-10 19:30:27 +08:00
1 parent fe39437968
commit 35240505e3
10 files changed
+712 -239

No files matched your search

@@ -4799,85 +4799,87 @@ namespace TemuKJD.WXForms.ProductForms
{
Brush textBrush = Brushes.Black;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
float txtY = 240;
float txtX = 280;
int txtWidth = 370;
float txtTop = 240;
float txtBottom = 240;
float txtLeft = 280;
float txtRight = 270;
int txtWidth = (int)imgW - (int)txtLeft - (int)txtRight; // 370;
// 书名
Font font = new Font("宋体", 22, FontStyle.Bold);
RectangleF rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
RectangleF rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(bookName.Replace("图书名称:", ""), font, textBrush, rectF);
// 测量文本的高度 决定接下来文字绘制位置
var textSize = g.MeasureString(bookName.Replace("图书名称:", ""), font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
font = new Font("宋体", 15, FontStyle.Bold);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(author.Replace("作  者:", "").TrimEnd('著', ' ') + " 著", font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(author.Replace("作  者:", "").TrimEnd('著', ' ') + " 著", font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(publisher.Replace("出版发行:", ""), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publisher.Replace("出版发行:", ""), font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(isbn.Replace("ISBN/CN刊号:", "ISBN "), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(isbn.Replace("ISBN/CN刊号:", "ISBN "), font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
// 以下从下往上写
txtY = imgH - 240;
txtTop = imgH - txtBottom;
// 测量文本的高度
textSize = g.MeasureString(binding, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(binding, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(edition, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(edition, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publishTime, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(publishTime, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(author, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(author, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(bookPrice + "元", font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(bookPrice + "元", font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(bookName, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(bookName, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(isbn.Replace("ISBN/CN刊号:", "书  号:ISBN "), font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(isbn.Replace("ISBN/CN刊号:", "书  号:ISBN "), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publisher, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(publisher, font, textBrush, rectF);
}