*********新手50分问个关于打印的问题,多谢解答!!************

binny0532 2005-06-17 01:53:31
一个多行的text文本框,里面显示了一些内容,可能会比较多,出现了滚动条

现在我想打印此页,不过由于内容在text文本框中,只能显示部分内容。向下拉动滚动条才会出现其他的内容,我现在想打印text中所有的内容,怎样实现?让text动态调整,还是怎样,或者不用text用其他的,请高手告知,多谢!!
...全文
100 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
binny0532 2005-06-22
  • 打赏
  • 举报
回复
我看了,csdn是越来越不行了。。。。。
binny0532 2005-06-21
  • 打赏
  • 举报
回复
还没有人回答,再顶
XqYuan 2005-06-17
  • 打赏
  • 举报
回复
顶一下
binny0532 2005-06-17
  • 打赏
  • 举报
回复
再顶,等高手
binny0532 2005-06-17
  • 打赏
  • 举报
回复
看不太懂,你这是vb。net吧
weixinzhu 2005-06-17
  • 打赏
  • 举报
回复
用PrintDocument(),贴段代码给你参考一下:
Dim bmp_bay_map As Bitmap
Dim bmpgraphics_bay_map As Graphics
Dim pen_line As New Pen(Color.Black, 1)
Dim print_result As New PrintDocument()

bmp_bay_map = New Bitmap(Me.Pl_bay_map.Width, Me.Pl_bay_map.Height)
bmpgraphics_bay_map = Graphics.FromImage(bmp_bay_map)
Me.Pl_bay_map.BackgroundImage = bmp_bay_map
…………………………………………………………
Private Sub btn_enter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_enter.Click
Try
Dim pd As New PrintDocument()
'pd.DefaultPageSettings.Landscape = True
AddHandler pd.PrintPage, AddressOf printpageeventhandler
' pd.printpage=pd.printpage+new PrintPageEventHandler(me.printpageeventhandler);
If (Me.storedpagesettings Is System.DBNull.Value) = False Then
pd.DefaultPageSettings = Me.storedpagesettings
End If
pd.DefaultPageSettings.Landscape = True
'Dim dlg As New PrintDialog()
'dlg.Document = pd
'dlg.AllowSelection = True
'dlg.AllowSomePages = True
'Dim result As DialogResult
'result = dlg.ShowDialog
'If (result = DialogResult.OK) Then
' pd.Print()

'End If
If (ptdlg Is Nothing) Then '第一次打印
ptdlg = New PrintDialog()
ptdlg.Document = pd
ptdlg.AllowSelection = False
ptdlg.AllowSomePages = False
ptdlg.AllowPrintToFile = False
ptdlg.ShowHelp = False
' ptdlg.PrinterSettings.

Dim result As DialogResult
result = ptdlg.ShowDialog
If (result = DialogResult.OK) Then
pd.Print()
End If
Else
'非第一次打印
pd.Print()
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub printpageeventhandler(ByVal obj As System.Object, ByVal ev As PrintPageEventArgs)
Dim g As Graphics
g = ev.Graphics

If Len(Trim(Me.txt_scale_rate.Text)) > 0 Then
Try
Dim expandPercent As Single = CType(Me.txt_scale_rate.Text, Integer) / 100
g.ScaleTransform(expandPercent, expandPercent)
Catch
MsgBox("请在缩放比例中输入数字!", MsgBoxStyle.OKOnly, "提示")
Exit Sub
End Try
End If
' g.ScaleTransform(0.8, 0.8)
print_bay_map(g)
ev.HasMorePages = False

End Sub


……………………………………
Private Sub print_bay_map(ByVal bmpgraphics_bay_map As Graphics) '现实
'Me.Pl_bay_map.Height = 1200
'清空
bmpgraphics_bay_map.Clear(Color.White)
……
bmpgraphics_bay_map.DrawString(bay_col_cabin, Me.Font, Brushes.Black, distolefe + col_count * 20 + 40 * (j - strsmallcol + strcon) + 13, distotop + board_height + 80 + (big_row_cabin - small_row_cabin + 1) * 40 + 5 + 40) '贝列

End Sub
binny0532 2005-06-17
  • 打赏
  • 举报
回复
自己顶一下

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧