Here's a command button user control. It's in the finalizing stage but if anyone is interested you can check out the code. It seems to be waaaaaaaayyy more stable when compiled than when in IDE.
Thanks to Eduardo (olelib.tlb), TheScrams.com (Tooltip class), LaVolpe and Steve McMahon (graphics) and people on forums like this. Goodnight.
X3BMenu:
vb Code:
Private WithEvents m As X3BMenu
Private Sub m_drawItem(ByVal lpDrawItemStruct As Long)
Dim d As DRAWITEMSTRUCT, szTxt As String, hGraphics As Long, tp As X3TextPrinter
Call m.fillDrawItemStruct(VarPtr(d), lpDrawItemStruct)
szTxt = m.getMenuItemText(d.CtlID)
Set tp = New X3TextPrinter
Call tp.setText(szTxt)
Call tp.setAlignment(EHAlignment.HCenter, EVAlignment.VCenter)
Call tp.setFont("Tahoma", 15, tp.getFontFlags(m.hasState(d.itemState, ODS_SELECTED), m.hasState(d.itemState, ODS_SELECTED), False, False))
Call tp.setLayoutRect(d.rcItem.Left, d.rcItem.Top, (d.rcItem.Right - d.rcItem.Left), (d.rcItem.Bottom - d.rcItem.Top))
Call tp.setOutlineEffect(&HFF0000FF, 190, 3)
Call tp.setTextColor(&HFFFFFFFF)
hGraphics = mUtil.getGraphicsContext(d.hdc)
Call mUtil.setAAGraphicsSmoothingMode(hGraphics)
Call mUtil.fillRectGDIP(hGraphics, &HFFFFFFFF, tp.DestX, tp.DestY, tp.DestW, tp.DestH)
Call tp.printText(hGraphics)
Call mUtil.deleteGraphicsContext(hGraphics)
End Sub
Private Sub m_measureItem(lW As Long, lH As Long, ByVal lData As Long, ByVal nID As Integer)
lH = 20
lW = (X3Button1.Width \ Screen.TwipsPerPixelX)
End Sub
Private Sub X3Button1_click(sX As Single, sY As Single)
Dim i As X3BIcon
Set m = New X3BMenu
Set i = New X3BIcon
Call i.loadIcon("d:\Programming\X3 Battlefield IRC\alpha.png")
Call m.setMenuItemText("Xiphias3", "Desolator", "\-", "Cancel")
Call m.setCheckmarkIcons(i, i, , i)
Call m.createMenu
Call m.setMenuItemChecked(0, True)
Call m.setMenuItemOwnerDrawStatus(1, True)
Call m.showMenu(X3Button1.hWnd, ALIGN_RIGHT)
End Sub