clsDIBSection ClassThis class permits you to manage an API Device Context in a safe way and provides conversion functions for VB6.
|
Name | Description |
---|---|
eBppType | Bits per Pixel Type |
eDibSectionBkMode | Background Mode |
Name | Description |
---|
Name | Type | Description |
---|---|---|
BitsPtr | (Long) | Returns the image bytes pointers of the internal image |
BkColor | (Long) | Gets or sets the background color of the internal Device Context |
BkMode | (eDibSectionBkMode) | Gets or sets the Background mode of the internal Device Context |
bPP | (eBppType) | Returns the number of Bits per pixel of the internal image |
BytesPerScanLine | (Long) | Returns the numbers of bytes used for storing a line of the internal bitmap (depends on the resolution) rounded to the next 4 bytes (used in many API functions) |
Icon | (Picture) | Creates a standard Picture object from the internal image (in ICON format) |
Palette | (clsPalette) | Returns the palette of the internal image |
Picture | (Picture) | Creates a standard Picture object from the internal image (in Bitmap format) |
Name | Type | Description |
---|---|---|
CloneFromDib | Clones another clsDIBSection class | |
CloneFromHBmp | Creates a DIB section from a bitmap handle, use PictureBox.Picture.Handle if you use VB6 controls | |
CloneFromHdc | Selects the image contained in the given Device Context and copies it to the new internal Device Context | |
CreateDC | Creates an image (DIB section) with a specified size (in pixels) and assign it to an internal Device context so you can easily use Windows drawing function on it | |
Destroy | Frees used resources, called automatically when the class terminates or a new value is assigned using [CloneFromDib], [CloneFromHBmp], [CloneFromHdc], [CreateDC] | |
DrawBackColor | Clear the internal image with a specified color | |
hDC | (Long) | Returns the handle of the internal Device Context |
hDib | (Long) | Returns the handle of the internal DIB section object |
Height | (Long) | Returns the height of the internal image (in pixels) |
PaintPicture | Draws the internal image to the specified Device Context | |
ReleasehDib | (Long) | Returns the internal DIB Section handle and leave the user the responsability to Delete it ([clsCommonWrapper.DeleteObject]) when useless After this call internal references to this object are deleted |
Width | (Long) | Returns the width of the internal image (in pixels) |
Option Explicit
Private Sub Form_Click()
Dim oDib As New clsDIBSection
oDib.CloneFromHBmp Image1.Picture.Handle
Dim oWrap As New clsCommonWrapper
oWrap.DrawRectCoords oDib.Hdc, 0, 0, oDib.Width, oDib.Height, vbRed, False
oDib.PaintPicture Me.Hdc
End Sub
Option Explicit
Private Sub Form_Click()
Dim oDib As New clsDIBSection
oDib.CloneFromHdc Me.Hdc
Dim oWrap As New clsCommonWrapper
oWrap.DrawRectCoords oDib.Hdc, 0, 0, oDib.Width, oDib.Height, vbRed, True
oDib.PaintPicture Me.Hdc
End Sub