Results 1 to 7 of 7

Thread: VB6 - X3Button

  1. #1

    Thread Starter
    Addicted Member Xiphias3's Avatar
    Join Date
    Jan 2009
    Location
    Clarendon, Jamaica
    Posts
    188

    Cool VB6 - X3Button

    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:
    1. Private WithEvents m As X3BMenu
    2.  
    3. Private Sub m_drawItem(ByVal lpDrawItemStruct As Long)
    4.     Dim d As DRAWITEMSTRUCT, szTxt As String, hGraphics As Long, tp As X3TextPrinter
    5.  
    6.     Call m.fillDrawItemStruct(VarPtr(d), lpDrawItemStruct)
    7.     szTxt = m.getMenuItemText(d.CtlID)
    8.  
    9.     Set tp = New X3TextPrinter
    10.     Call tp.setText(szTxt)
    11.     Call tp.setAlignment(EHAlignment.HCenter, EVAlignment.VCenter)
    12.     Call tp.setFont("Tahoma", 15, tp.getFontFlags(m.hasState(d.itemState, ODS_SELECTED), m.hasState(d.itemState, ODS_SELECTED), False, False))
    13.     Call tp.setLayoutRect(d.rcItem.Left, d.rcItem.Top, (d.rcItem.Right - d.rcItem.Left), (d.rcItem.Bottom - d.rcItem.Top))
    14.     Call tp.setOutlineEffect(&HFF0000FF, 190, 3)
    15.     Call tp.setTextColor(&HFFFFFFFF)
    16.  
    17.     hGraphics = mUtil.getGraphicsContext(d.hdc)
    18.     Call mUtil.setAAGraphicsSmoothingMode(hGraphics)
    19.     Call mUtil.fillRectGDIP(hGraphics, &HFFFFFFFF, tp.DestX, tp.DestY, tp.DestW, tp.DestH)
    20.     Call tp.printText(hGraphics)
    21.     Call mUtil.deleteGraphicsContext(hGraphics)
    22. End Sub
    23.  
    24. Private Sub m_measureItem(lW As Long, lH As Long, ByVal lData As Long, ByVal nID As Integer)
    25.     lH = 20
    26.     lW = (X3Button1.Width \ Screen.TwipsPerPixelX)
    27. End Sub
    28.  
    29. Private Sub X3Button1_click(sX As Single, sY As Single)
    30.     Dim i As X3BIcon
    31.  
    32.     Set m = New X3BMenu
    33.     Set i = New X3BIcon
    34.  
    35.     Call i.loadIcon("d:\Programming\X3 Battlefield IRC\alpha.png")
    36.     Call m.setMenuItemText("Xiphias3", "Desolator", "\-", "Cancel")
    37.     Call m.setCheckmarkIcons(i, i, , i)
    38.     Call m.createMenu
    39.     Call m.setMenuItemChecked(0, True)
    40.     Call m.setMenuItemOwnerDrawStatus(1, True)
    41.     Call m.showMenu(X3Button1.hWnd, ALIGN_RIGHT)
    42. End Sub
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by Hack; Jan 8th, 2010 at 07:19 AM. Reason: Removed Compiled Code From Attachment

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: VB6 - X3Button

    In accordance with this CodeBank policy regarding attachments, I have edited yours and removed all compiled files.

    Please post only source code in any CodeBank attachment.

    Thank you.

  3. #3
    New Member
    Join Date
    Aug 2004
    Posts
    2

    Re: VB6 - X3Button

    where is the XPButton.ocx?

  4. #4
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: VB6 - X3Button

    You can compile it yourself.
    Codebak policy states (as mentioned above) that no compiled material shall be included.
    Delete it. They just clutter threads anyway.

  5. #5

    Thread Starter
    Addicted Member Xiphias3's Avatar
    Join Date
    Jan 2009
    Location
    Clarendon, Jamaica
    Posts
    188

    Re: VB6 - X3Button

    Quote Originally Posted by tanaya View Post
    where is the XPButton.ocx?
    You have to compile the X3Button youself as well as the X3RTFPrinter if you're gonna include the windowless rich edit implementation. You need vc++ 2k8 to compile the X3RTFPrinter.dll.
    Last edited by Xiphias3; Jan 18th, 2010 at 12:00 PM.

  6. #6
    Hyperactive Member Condomx's Avatar
    Join Date
    Dec 2009
    Location
    Iligan City,Philippines
    Posts
    327

    Re: VB6 - X3Button

    Xiphias3-oh man thats painful..i though i could see directly on what seem to be seen in this beautiful buttons..oh man i see so therefore i have to do a lot to get this button?. ah if this gonna be then thank you but i am not interested anymore..
    ~[L!f3 !s @ll @ab0ut l3@rn!ng]~

    ~*D0nt Give up, h0pe is always present*~

  7. #7

    Thread Starter
    Addicted Member Xiphias3's Avatar
    Join Date
    Jan 2009
    Location
    Clarendon, Jamaica
    Posts
    188

    Re: VB6 - X3Button

    Quote Originally Posted by Condomx View Post
    Xiphias3-oh man thats painful..i though i could see directly on what seem to be seen in this beautiful buttons..oh man i see so therefore i have to do a lot to get this button?. ah if this gonna be then thank you but i am not interested anymore..
    This is a late reply, however you can easily rip out the rtf features or wait until i put together a ITextHost tlb and implement the RTF functionality in VB.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width