'Several GDI drawing function packages have a genericity, some are the modules I usually use.
Private Function NewMyHdc (dHdc As Long, w As Long, h As Long, Optional Bm As Long) As MemHdc With NewMyHdc .hdc = CreateCompatibleDC (dHdc) If Bm = 0 Then .Bmp = CreateCompatibleBitmap (dHdc, w, h) Else. Bmp = Bm End If .obm = SelectObject (.hdc, .Bmp) End WithEnd FunctionPrivate Function DelMyHdc (MyHdc As MemHdc, Optional nobmp As Boolean) As MemHdc With MyHdc If .hdc <> 0 Then SelectObject .hdc, .obm If nobmp = False Then DeleteObject .Bmp DeleteDC .hdc End If End WithEnd FunctionPrivate Sub DrawPloy3 (hdc As Long, rcDrop As RECT, Up As Boolean) 'Videos dropdown small triangle Dim ploy (2) As pOINTL Dim hBrush As Long, hOldBrush As Long Dim HPEN As Long, Holdpen As Long with Rcdrop if Up1 .right = .left - 1 .right = .right - 1 .top = .top - 1 .bottom = .bottom - 1 Hbrush = Createsolidbrush (M_LNGTEXTHICOLOR) hPen = CreatePen (PS_SOLID, 1, m_lngTextHiColor) Else hBrush = CreateSolidBrush (m_lngTextColor) hPen = CreatePen (PS_SOLID, 1, m_lngTextColor) End If hOldPen = SelectObject (hdc, hPen) hOldBrush = SelectObject (hdc, hBrush) ploy (0). X = (.left .right - 5) / 2 PLOY (0) .y = (.top .bottom) / 2 PLOY (1) .x = PLOY (0) .x 4 PLOY (1) .y = PLOY (0) .y ploy (2) .x = pLOY (0) .x 2 PLOY (2) .y = ploy (0) .y
2 End With Polygon hdc, ploy (0), 3 SelectObject hdc, hOldPen SelectObject hdc, hOldBrush DeleteObject hPen DeleteObject hBrushEnd SubPrivate Sub GetIconSize (hIcon As Long) 'acquired image list box icon size Dim Bm As BITMAP, bi As ICONINFO GetIconInfo hIcon , bi GetObj bi.hbmColor, Len (Bm), Bm DeleteObject bi.hbmColor DeleteObject bi.hbmMask mlngIconWidth = Bm.bmWidth mlngIconHeight = Bm.bmHeightEnd SubPrivate Sub DrawRect (hdc As Long, rc As RECT, State As Long, Optional IsDrop As Boolean) DIM HPEN AS long if (state> 0 or isdrop) and m_lngbrdstyle> 3 Then HPEN = createpen (ps_solid, 1, m_lngbrdcolor) if isdrop the rc.left = rc.Left - 1 FrameRect HDC, RC, HPEN ISDROP THEN Rc.Left = rc.LEFT 1 deleteObject HPEN EXIT SUB End If SETET CASE STATE CASE 0 'Ordinary SELECT CASE M_LNGBRDSTYLE CASE 1 IF IsDrop The DrawEdge HDC, RC, BDR_outer, BF_Rect OR BF_FLAT Case 2 DrawEdge hdc, rc, BDR_RAISEDOUTER, BF_RECT Case 3 DrawEdge hdc, rc, EDGE_RAISED, BF_RECT End Select Case 1 'state highlight Select Case m_lngBrdStyle Case 0 DrawEdge hdc, rc, BDR_RAISEDINNER, BF_RECT Case 1, 2, 3 DrawEdge hdc, RC, EDGE_RAISED, BF_RECT End SELECT CASE 2 '