Unicode Controls & Classes for VB6 - Version 4

clsMEMDC.CloneFromHBmp Method

Creates a bitmap from another bitmap handle, use PictureBox.Picture.Handle if you use VB6 controls

Syntax
Public Sub CloneFromHBmp (ByVal hBmp As Long, _
Optional ByRef iBkMode As eMemDcBkMode = eMemDcBkMode_TRANSPARENT)
Parameters
Parameter Description
ByVal hBmp As Long The source handle to use
Optional ByRef iBkMode As eMemDcBkMode = eMemDcBkMode_TRANSPARENT The background mode for the new Device Context
Remarks
In this sample we'll countour an image
Option Explicit

Private Sub Form_Click()

Dim oDib As New clsMemDC
oDib.CloneFromHBmp Image1.Picture.Handle

Dim oWrap As New clsCommonWrapper
oWrap.DrawRectCoords oDib.Hdc, 0, 0, oDib.Width, oDib.Height, vbRed, True

oDib.PaintPicture Me.Hdc

End Sub