ImageGear Professional for Windows ActiveX
AttrDIB Property

Description:

Gets or sets the raw bitmap (DIB) of a Image Embedded mark. Before using this property, you must load the IGArtPage Object.AttrXXX properties with the values from a specific mark by calling IGArtPage Object.

The following code demonstrates how to get a pointer to a DIB from an IGPage object, how to create an embedded bitmap mark from a DIB, and how to replace that DIB with another one using AttrDIB. Note, that Embedded bitmap mark images MUST be 4bpp or less.

 
Copy Code
' Given an IGPage object, returns a pointer to the image's DIB
' The following two Win32 API declarations are necessary for
this to work:
' (make them Public and put them in a module, or Private and put
them at the top of a form)
' Public Declare Function GlobalLock Lib "kernel32" (ByVal hMem
As Long) As Long
' Public Declare Function GlobalUnlock Lib "kernel32" (ByVal
hMem As Long) As Long
Function getDIBPtr(page As IGPage) As Long
    Dim DIBHandle As Long
    DIBHandle = page.GetDIBHandle
    getDIBPtr = GlobalLock(DIBHandle)
    GlobalUnlock DIBHandle
End Function
    ' Load the image to be annotated and make an ART page
    IGFormatsCtl1.LoadPageFromFile currentPage,
"c:\temp\test2.jpg", 0
    Set artPage = IGArtCtl1.CreateArtPage(currentPage,
currentPageDisp, IGPageViewCtl1.hWnd)
    ' Load image 1
    Dim pageMark1 As IGPage
    Set pageMark1 = IGCoreCtl1.CreatePage
    IGFormatsCtl1.LoadPageFromFile pageMark1,
"c:\temp\smile.bmp", 0
    ' Load image 2
    Dim pageMark2 As IGPage
    Set pageMark2 = IGCoreCtl1.CreatePage
    IGFormatsCtl1.LoadPageFromFile pageMark2,
"c:\temp\frown.bmp", 0
    ' Create a mark using image 1
    artPage.GlobalAttrDIB = getDIBPtr(pageMark1)
    artPage.GlobalAttrBounds.Left = 100
    artPage.GlobalAttrBounds.Top = 100
    artPage.GlobalAttrBounds.Right = 164
    artPage.GlobalAttrBounds.Bottom = 164
    Dim markIndex As Long
    markIndex = artPage.MarkCreate(markImageEmbedded)
    ' Replace it with image 2
    artPage.MarkQuery markIndex
    artPage.AttrDIB = getDIBPtr(pageMark2)

Property Type:

Read-write property

Return Type:

Long

Default Value: As per GlobalAttrDIB Property

Valid Values: Typically, you'll call the IGPage Object.GetImagePtr method to get an image pointer that can be used to set this property.

Bits Per Pixel:

N/A

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback