抛砖引玉,先给出一段代码看一看,实现强制换页并在新也上生成相应的空白区域,需要你建一个Bitmap1.bmp文件,并拷贝到bin目录下:
- private void btnNewPage_Click(object sender, EventArgs e)
- {
- Graphics g = textControl1.CreateGraphics();
- int DPI = (int)(1440 / g.DpiX);
- TXTextControl.Line topLine = textControl1.Lines[1];
- TXTextControl.Line bottomLine = textControl1.Lines[textControl1.InputPosition.Line];
- this.textControl1.Selection.Text = "\f";
- Rectangle rect = new Rectangle(
- ((topLine.TextBounds.X / DPI) ) - (textControl1.ScrollLocation.X / DPI),
- (topLine.TextBounds.Top / DPI) - (textControl1.ScrollLocation.Y / DPI),
- 500,
- (bottomLine.TextBounds.Bottom / DPI) - (topLine.TextBounds.Top / DPI));
- textControl1.Images.Clear();
- textControl1.Images.Add(new TXTextControl.Image(new Bitmap(Image.FromFile("Bitmap1.bmp"), 100, rect.Height)), new Point(topLine.TextBounds.X / DPI, topLine.TextBounds.Y / DPI), TXTextControl.ImageInsertionMode.FixedOnPage);
- textControl1.Refresh();
- }
复制代码 |