• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

[VB] Custom Symbol??

Carmen

Member
I find an example of class module which allow user to replace a point object by a cross (custom symbol) when drawing a point, how could I make this custom symbol to be a bitmap graphic, i.e, the bitmap appear instead of a point when drawing.

Option Explicit

' Data members
Private m_pen As Long
Private m_oldPen As Long
Private m_size As Long

' Win32 API functions
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As Long) As Long

Public Sub Draw(hdc As Long, x As Long, y As Long)
MoveToEx hdc, x - m_size, y - m_size, 0
LineTo hdc, x + m_size + 1, y + m_size + 1
MoveToEx hdc, x + m_size + 1, y - m_size, 0
LineTo hdc, x - m_size, y + m_size + 1
End Sub

Public Sub ResetDC(hdc As Long)
SelectObject hdc, m_oldPen
DeleteObject m_pen
End Sub

Public Sub SetupDC(hdc As Long, dpi As Double, baseSym As Object)
m_pen = CreatePen(0, 1, baseSym.Color)
m_oldPen = SelectObject(hdc, m_pen)
m_size = baseSym.Size
End Sub

Great Thanks
 
Back
Top