# VB 存 picturebox 做 BMP 档

Posted by Kurama on May 05, 1998 at 14:54:09:

本人是VB新手, 请各位高手多多指教:

为何picture7 (PictureBox) 内的图形能在程式内正常显示,
但用SavePicture存做bmp档时只存到一幅灰色的图 ?
请问错在何处 ? OR 应该用其他指令 ?
THANKS !!!!!

----------
'一个Form, 七个PictureBox
'a.bmp, b.bmp, 1.bmp, 2.bmp, 3.bmp, 4.bmp : 24bits 100*100 BMP 档
'存出来的 car1.bmp : 24bits 600*100 BMP 档, 但不知为何只得灰色 ?

Private Sub Form_Activate()
Picture7.PaintPicture Picture1, 0, 0, 100, 100, 0, 0, 100, 100
Picture7.PaintPicture Picture2, 100, 0, 100, 100, 0, 0, 100, 100
Picture7.PaintPicture Picture3, 200, 0, 100, 100, 0, 0, 100, 100
Picture7.PaintPicture Picture4, 300, 0, 100, 100, 0, 0, 100, 100
Picture7.PaintPicture Picture5, 400, 0, 100, 100, 0, 0, 100, 100
Picture7.PaintPicture Picture6, 500, 0, 100, 100, 0, 0, 100, 100
End Sub

Private Sub Form_Load()

AutoRedraw = True
ScaleMode = 3

Picture1 = LoadPicture("c:\project\a.bmp")
Picture2 = LoadPicture("c:\project\b.bmp")
Picture3 = LoadPicture("c:\project\1.bmp")
Picture4 = LoadPicture("c:\project\2.bmp")
Picture5 = LoadPicture("c:\project\3.bmp")
Picture6 = LoadPicture("c:\project\4.bmp")

With Picture1:
.Visible = False
.AutoRedraw = True
.ScaleMode = 3
.BorderStyle = 0
.Width = 100
.Height = 100
End With

With Picture2
.Visible = False
.AutoRedraw = True
.ScaleMode = 3
.BorderStyle = 0
.Width = 100
.Height = 100
End With

With Picture3
.Visible = False
.AutoRedraw = True
.ScaleMode = 3
.BorderStyle = 0
.Width = 100
.Height = 100
End With

With Picture4
.Visible = False
.AutoRedraw = True
.ScaleMode = 3
.BorderStyle = 0
.Width = 100
.Height = 100
End With

With Picture5
.Visible = False
.AutoRedraw = True
.ScaleMode = 3
.BorderStyle = 0
.Width = 100
.Height = 100
End With

With Picture6
.Visible = False
.AutoRedraw = True
.ScaleMode = 3
.BorderStyle = 0
.Width = 100
.Height = 100
End With

With Picture7
.ScaleMode = 3
.BorderStyle = 0
.Width = 600
.Height = 100
.AutoRedraw = True
End With

SavePicture Picture7.Image, "c:\project\car1.bmp"

End Sub
----------

Follow Ups:

- 顺序不对 小吴 18:34:55 5/05/98 (0)