当前有个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);
望兄弟们多多指教!!谢谢!

解决方案 »

  1.   

    看起来像是 Delphi 类库的 Class,这是没有直接对应的。
      

  2.   

    两个语言不可能有完全对应的类库。
    VB 的 PictureBox 控件可以做类似的绘图,不过控件不像类可以独立创建实例,必须存在于窗体上。
      

  3.   

    谢谢诸位的回复!
    Tiger:我在其他地方(http://topic.csdn.net/u/20090221/17/d88255d6-1839-47c5-9745-bbaf5f5b2779.html)看到你的回复,我想得到图象的bitmap数组,是否GetDIBits函数出结果就是我所需要的?
      

  4.   

    bBytes数组中保存的是整个图象的字节数据吗?
    如何获取每个象素点的RGB的值,是在bBytes数组中吗?
    谢谢!
      

  5.   

    是的,数组中就是3个字节一组存放每个点的 RGB 值。
      

  6.   

    Tiger:点的排布是以行优先还是列优先?谢谢!
      

  7.   

    有点象:
    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
      

  8.   

    位图数据记录了位图的每一个像素值,记录顺序是在扫描行内是从左到右,扫描行之间是从下到上。
    位图的一个像素值所占的字节数: 
      当biBitCount=1时,8个像素占1个字节;
      当biBitCount=4时,2个像素占1个字节;
      当biBitCount=8时,1个像素占1个字节;
      当biBitCount=24时,1个像素占3个字节;