Type BITMAPFILEHEADER bfType As String * 2 bfSize As Long bfReserved1 As Integer bfReserved2 As Integer bfOffBits As Long End TypeType BitMapInfoHeader biSize As Long biWidth As Long biHeight As Long biPlanes As Integer biBitCount As Integer biCompression As Long biSizeImage As Long biXPelsPerMeter As Long biYPelsPerMeter As Long biClrUsed As Long biClrImportant As Long End Type
非常谢谢两位! 我希望得到的是bmp格式的实现源代码 上面紧紧是定义了位图类的格式而已
用SavePicture函数保存的就是bmp格式的图像。 SavePicture 语句 从对象或控件(如果有一个与其相关)的 Picture 或 Image 属性中将图形保存到文件中。语法SavePicture picture, stringexpressionSavePicture 语句的语法包含下面部分:参数 描述 picture 产生图形文件的 PictureBox 控件或 Image 控件。 stringexpression 欲保存的图形文件名。 说明无论在设计时还是运行时图形从文件加载到对象的 Picture 属性,而且它是位图、图标、元文件或增强元文件,则图形将以原始文件同样的格式保存。如果它是 GIF 或 JPEG 文件,则将保存为位图文件。Image 属性中的图形总是以位图的格式保存而不管其原始格式。SavePicture 语句示例 本例使用 SavePicture 语句保存画在 Form 对象的 Picture 属性中的图形。要试用此例,可将以下代码粘贴到 Form 对象的声明部分,然后运行此例,单击 Form 对象。Private Sub Form_Click () ' 声明变量。 Dim CX, CY, Limit, Radius as Integer, Msg as String ScaleMode = vbPixels ' 设置比例模型为像素。 AutoRedraw = True ' 打开 AutoRedraw。 Width = Height ' 改变宽度以便和高度匹配。 CX = ScaleWidth / 2 ' 设置 X 位置。 CY = ScaleHeight / 2 ' 设置 Y 位置。 Limit = CX ' 圆的尺寸限制。 For Radius = 0 To Limit ' 设置半径。 Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255) DoEvents ' 转移到其它操作。 Next Radius Msg = "Choose OK to save the graphics from this form " Msg = Msg & "to a bitmap file." MsgBox Msg SavePicture Image, "TEST.BMP" ' 将图片保存到文件。 End Sub
Public Type BITMAPFILEHEADER bfType As Integer bfSize As Long bfReserved1 As Integer bfReserved2 As Integer bfOffBits As Long End Type Public Type BITMAPINFOHEADER '40 bytes biSize As Long biWidth As Long biHeight As Long biPlanes As Integer biBitCount As Integer biCompression As Long biSizeImage As Long biXPelsPerMeter As Long biYPelsPerMeter As Long biClrUsed As Long biClrImportant As Long End Type Public Type RGBQUAD rgbBlue As Byte rgbGreen As Byte rgbRed As Byte rgbReserved As Byte End Type Public Type PALETTEENTRY peRed As Byte peGreen As Byte peBlue As Byte peFlags As Byte End Type
模糊了一点,不过里面是有bmp的文件格式的
bfType As String * 2
bfSize As Long
bfReserved1 As Integer
bfReserved2 As Integer
bfOffBits As Long
End TypeType BitMapInfoHeader
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
我希望得到的是bmp格式的实现源代码
上面紧紧是定义了位图类的格式而已
SavePicture 语句
从对象或控件(如果有一个与其相关)的 Picture 或 Image 属性中将图形保存到文件中。语法SavePicture picture, stringexpressionSavePicture 语句的语法包含下面部分:参数 描述
picture 产生图形文件的 PictureBox 控件或 Image 控件。
stringexpression 欲保存的图形文件名。
说明无论在设计时还是运行时图形从文件加载到对象的 Picture 属性,而且它是位图、图标、元文件或增强元文件,则图形将以原始文件同样的格式保存。如果它是 GIF 或 JPEG 文件,则将保存为位图文件。Image 属性中的图形总是以位图的格式保存而不管其原始格式。SavePicture 语句示例
本例使用 SavePicture 语句保存画在 Form 对象的 Picture 属性中的图形。要试用此例,可将以下代码粘贴到 Form 对象的声明部分,然后运行此例,单击 Form 对象。Private Sub Form_Click ()
' 声明变量。
Dim CX, CY, Limit, Radius as Integer, Msg as String
ScaleMode = vbPixels ' 设置比例模型为像素。
AutoRedraw = True ' 打开 AutoRedraw。
Width = Height ' 改变宽度以便和高度匹配。
CX = ScaleWidth / 2 ' 设置 X 位置。
CY = ScaleHeight / 2 ' 设置 Y 位置。
Limit = CX ' 圆的尺寸限制。
For Radius = 0 To Limit ' 设置半径。
Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
DoEvents ' 转移到其它操作。
Next Radius
Msg = "Choose OK to save the graphics from this form "
Msg = Msg & "to a bitmap file."
MsgBox Msg
SavePicture Image, "TEST.BMP" ' 将图片保存到文件。
End Sub
但是我做这个设计必须要先编程bmp我图片文件格式代码才能读取bmp图片
不允许在为有bmp文件格式之前来浏览任何图片(也就是不运行拉控件来实现图片的浏览)
太多了,贴不下,而且论坛也不支持有格式的文档。
bfType As Integer
bfSize As Long
bfReserved1 As Integer
bfReserved2 As Integer
bfOffBits As Long
End Type
Public Type BITMAPINFOHEADER '40 bytes
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Public Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Public Type PALETTEENTRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type
里面的类封的都不错!
http://www.aivisoft.net/zyl910/index.asp
ZylDIBop.zip里就有完整的类!