回复 1楼gaishitaibao的帖子
实现方法如下:
- private Brush LINE_COLOR = new SolidBrush(Color.Gray);
- private int LINE_DISTANCE = 40;
- private void linenumberToolStripMenuItem_Click(object sender, EventArgs e)
- {
- textControl1.Refresh(); Graphics g = textControl1.CreateGraphics();
- int DPI = (int)(1440 / g.DpiX); foreach (TXTextControl.Line line in textControl1.Lines) { g.DrawString(line.Number.ToString() + ":", new Font(textControl1.Font.Name, textControl1.Font.Size), LINE_COLOR, new PointF(((line.TextBounds.X / DPI) - LINE_DISTANCE) - (textControl1.ScrollLocation.X / DPI), (line.TextBounds.Top / DPI) - (textControl1.ScrollLocation.Y / DPI))); }
- }
复制代码 |