当前有个Delphi程序想转换成VB的。其中如题两个数据类型不知在VB中如何对应。其中部分设置tpicture类型数据的delphi语句如下:p:=tpicture.create;
p.bitmap.width:=x;
p.bitmap.height:=y;
p.bitmap.canvas.pen.color:=vlblack;
p.bitmap.canvas.textout(0,0,text);
望兄弟们多多指教!!谢谢!
p.bitmap.width:=x;
p.bitmap.height:=y;
p.bitmap.canvas.pen.color:=vlblack;
p.bitmap.canvas.textout(0,0,text);
望兄弟们多多指教!!谢谢!
解决方案 »
- 着急!怎么把一个象素单位表示的值转换为缇表示的值?有没有什么API啊
- 求助各位大哥,关于mciSendString的问题
- 字符串截取的问题,急急急!
- 我想用水晶报表,请问要如何安装?
- 鼠标移动到窗体上时,窗体自动移开的代码哪里有下载
- 请问怎么可以使MSHFlexGrid控件在窗体中的大小是相对大小,即放大窗体,该控件能自动按比例放大?
- 关于窗体上的toolbar问题
- 初学: 如何模拟键盘的组合按键?(内祥)
- 紧急求救,200分的问题!(关于核心字体的问题)
- 有谁做过天敏的sdk2000视频监控卡的开发没有?
- 如何取QQ网页登陆验证码,并显示在picturebox控件上。
- 请问我想程序退出后保存变量的值,以便下次使用
VB 的 PictureBox 控件可以做类似的绘图,不过控件不像类可以独立创建实例,必须存在于窗体上。
Tiger:我在其他地方(http://topic.csdn.net/u/20090221/17/d88255d6-1839-47c5-9745-bbaf5f5b2779.html)看到你的回复,我想得到图象的bitmap数组,是否GetDIBits函数出结果就是我所需要的?
如何获取每个象素点的RGB的值,是在bBytes数组中吗?
谢谢!
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" _
(ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) _
As Long
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, _
ByVal dwCount As Long, lpBits As Any) As LongPrivate Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End TypePrivate Sub Command1_Click()
Dim hBitmap As Long
Dim res As Long
Dim bmp As BITMAP
Dim byteAry() As Byte
Dim totbyte As Long, i As Long
hBitmap = Picture1.Picture.Handle res = GetObject(hBitmap, Len(bmp), bmp) '取得BITMAP的结构 totbyte = bmp.bmWidthBytes * bmp.bmHeight '总共要多少BYTE来存图
ReDim byteAry(totbyte - 1)
'将Picture1中的图信息存到ByteAry
res = GetBitmapBits(hBitmap, totbyte, byteAry(0)) Debug.Print "Total Bytes Copied :"; res
Debug.Print "bmp.bmBits "; bmp.bmBits
Debug.Print "bmp.bmBitsPixel "; bmp.bmBitsPixel '每相素位数
Debug.Print "bmp.bmHeight "; bmp.bmHeight '以相素计算图象高度
Debug.Print "bmp.bmPlanes "; bmp.bmPlanes
Debug.Print "bmp.bmType "; bmp.bmType
Debug.Print "bmp.bmWidth "; bmp.bmWidth '以相素计算图形宽度
Debug.Print "bmp.bmWidthBytes "; bmp.bmWidthBytes '以字节计算的每扫描线长度
End Sub
位图的一个像素值所占的字节数:
当biBitCount=1时,8个像素占1个字节;
当biBitCount=4时,2个像素占1个字节;
当biBitCount=8时,1个像素占1个字节;
当biBitCount=24时,1个像素占3个字节;