如何在矩形中获取文本框(x,y)的位置?
RectangleF srcRect = new Rectangle(0, 0, this.BackgroundImage.Width,
BackgroundImage.Height);
int nWidth = printDocument1.PrinterSettings.DefaultPageSettings.PaperSize.Width;
int nHeight = printDocument1.PrinterSettings.DefaultPageSettings.PaperSize.Height;
RectangleF destRect = new Rectangle(0, 0, nWidth, nHeight);
g.DrawImage(this.BackgroundImage, destRect, srcRect, GraphicsUnit.Pixel);
e.Graphics.DrawString(textBox15.Text, textBox15.Font,
new SolidBrush(textBox15.ForeColor),
/*x location base on rectangle*/,
/*y location based on rectagle8*/);
答案 0 :(得分:0)
以下是提示使用.Right
和.Top
e.Graphics.DrawString(textBox15.Text, textBox15.Font, new SolidBrush(textBox15.ForeColor), srcRect.Right, srcRect.Top);