想請問VB的先進們,放在PictureBox中的元件,如Label,checkBox.....等,為什麼無法列印出來,而Picture1.print \"a\"就可以列印.PS(已設定Picture1.Autoredraw=Ture)
2006-03-15 09:05:27 · 2 個解答 · 發問者 ChIoU 1 in 電腦與網際網路 ➔ 程式設計
'表單置1個PictureBox,2個CommandButton,PictureBox內放置幾個Label'方式1:直接將Label的Caption畫到PictureBox,再列印PictureBox的ImagePrivate Sub Command1_Click()Dim I As IntegerWith Picture1 .AutoRedraw = True For I = 0 To Controls.Count - 1 If TypeOf Controls(I) Is Label Then If Controls(I).Container.Name = "Picture1" Then .CurrentX = Controls(I).Left .CurrentY = Controls(I).Top .ForeColor = Controls(I).ForeColor .Font.Name = Controls(I).Font.Name .Font.Size = Controls(I).Font.Size .Font.Bold = Controls(I).Font.Bold .Font.Italic = Controls(I).Font.Italic .Font.Underline = Controls(I).Font.Underline .Font.Strikethrough = Controls(I).Font.Strikethrough Picture1.Print Controls(I).Caption End If End If Next .AutoRedraw = False Printer.PaintPicture .Image, 0, 0End WithPrinter.EndDocEnd Sub'方式2:將表單大小設成跟PictureBox一樣,用PrintForm方法列印Private Sub Command2_Click()Dim fx&, fy&, px&, py&fx = .Width: fy = .HeightWith Picture1 px = .Left: py = .Top: .ZOrder .Left = 0: .Top = 0 Do Until ScaleWidth <= .Width Me.Width = Me.Width - 1 Loop Do Until ScaleHeight <= .Height Height = Height - 1 Loop DoEvents Me.PrintForm Width = fx: Height = fy .Left = px: .Top = pyEnd WithEnd Sub
2006-03-14 18:54:47 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
請問要如何將方法1的方式適用在Line的物件上?
2007-02-26 06:14:07 · answer #2 · answered by ivangx 1 · 0⤊ 0⤋