当前有个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);
望兄弟们多多指教!!谢谢!
解决方案 »
- 想实现这样的效果,不知用VB如何控制EXCEL?
- 如何提取数据库表1的序号列的最大值并在TEXTBOX中显示?
- 请教高手:vsprint8中如何获得TableCell画的的某条线的坐标(即该线条的x1,y1--x2,y2)
- 打印问题!!!
- 急急急!!!
- 痛
- 进度条如何和一个动作相连接呀?完成同步的效果!
- 狂送100分(31)
- 紧急求教:动态报表问题,用vb自带的datareport?如何动态添加字段?100分!在线等待!谢谢了
- 关于winsock不能大量传送的问题。(比较难,请各位大虾不要在乎分数,请教)
- 如何取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个字节;