Results 1 to 7 of 7

Thread: menu

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    menu

    is there a way to edit the menu to make it look like internet explorer's? In vb, the menus are poped in, making it looking kinda ugly. if you compare them, you will know what i'm talking about. I cant find any settings related to the menu at all

  2. #2
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: menu

    What effect are you looking for? How do they look in VB? Can you post screenshots?

    Do you mean the fade effect when the menu opens? Or the toolbar part of the menu bar? Or what it looks like when you mouse-over it?

    Can you please answer these so we can better help you?
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: menu

    Or are you talking about placing icons on the menus?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    Re: menu

    I'm not talking about icons, here:





    do you see the difference? the one in vb looks ugly cause it's poped in (the menu toolbar)

  5. #5
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: menu

    Why don't you post some screen shots? So that we can understand better what exactly you are looking for?
    CS

  6. #6
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: menu

    You can have a Raised or Etched Menu line with this code:

    This assumes that your Form Scalemode is VBTwips, if you are using VbPixels or some other, I think you could use ScaleX and ScaleY to fix coordinates.

    VB Code:
    1. Private Declare Function GetSysColor Lib "user32" _
    2.    (ByVal nIndex As Long) As Long
    3.  
    4. Private Const COLOR_BTNFACE = 15
    5. Private Const COLOR_BTNSHADOW = 16
    6.  
    7. Private Enum enuStyle
    8.     Raised
    9.     Etched
    10. End Enum
    11.  
    12. Private Sub setMenuStyle(pStyle As enuStyle)
    13.     Select Case pStyle
    14.         Case Raised
    15.             Me.Line (0, 15)-(ScaleWidth, 15), GetSysColor(COLOR_BTNSHADOW)
    16.             Me.Line (0, 0)-(ScaleWidth, 0), vbWhite
    17.         Case Etched
    18.             Me.Line (0, 15)-(ScaleWidth, 15), vbWhite
    19.             Me.Line (0, 0)-(ScaleWidth, 0), GetSysColor(COLOR_BTNSHADOW)
    20.     End Select
    21. End Sub
    22.  
    23. Private Sub Form_Load()
    24.     setMenuStyle Etched
    25. End Sub
    26.  
    27. Private Sub Form_Paint()
    28.     setMenuStyle Etched 'Also here, so it works even when resizing
    29. End Sub

    If you use a Toolbar, you don't need that code, since the Menu will look Etched (Toolbar Appearance must be = 0 [cc3D]).

    If you also want to change the Menu color, you can use this code:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Const MIM_BACKGROUND As Long = &H2
    4. Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000
    5.  
    6. Private Type MENUINFO
    7.     cbSize As Long
    8.     fMask As Long
    9.     dwStyle As Long
    10.     cyMax As Long
    11.     hbrBack As Long
    12.     dwContextHelpID As Long
    13.     dwMenuData As Long
    14. End Type
    15.  
    16. Private Declare Function DrawMenuBar Lib "user32" _
    17.     (ByVal hwnd As Long) As Long
    18. Private Declare Function GetMenu Lib "user32" _
    19.     (ByVal hwnd As Long) As Long
    20. Private Declare Function SetMenuInfo Lib "user32" _
    21.     (ByVal hmenu As Long, _
    22.     mi As MENUINFO) As Long
    23. Private Declare Function CreateSolidBrush Lib "gdi32" _
    24.     (ByVal crColor As Long) As Long
    25. Private Declare Function OleTranslateColor Lib "olepro32.dll" _
    26.     (ByVal OLE_COLOR As Long, _
    27.     ByVal HPALETTE As Long, _
    28.     pccolorref As Long) As Long
    29.  
    30. Private Function SetMenuColor(ByVal hwndfrm As Long, ByVal dwColour As Long, _
    31.                                ByVal bIncludeSubmenus As Boolean) As Boolean
    32. Dim mi          As MENUINFO
    33. Dim flags       As Long
    34. Dim clrref      As Long
    35.    
    36.     clrref = TranslateColor(dwColour)
    37.     flags = MIM_BACKGROUND
    38.    
    39.     If bIncludeSubmenus Then
    40.         flags = flags Or MIM_APPLYTOSUBMENUS
    41.     End If
    42.    
    43.     With mi
    44.         .cbSize = Len(mi)
    45.         .fMask = flags
    46.         .hbrBack = CreateSolidBrush(clrref)
    47.     End With
    48.    
    49.     SetMenuInfo GetMenu(hwndfrm), mi
    50.     DrawMenuBar hwndfrm
    51. End Function
    52.  
    53. Private Function TranslateColor(ByVal dwOleColour As Long) As Long
    54.     OleTranslateColor dwOleColour, 0, TranslateColor
    55. End Function
    56.  
    57. Private Sub Form_Load()
    58.     SetMenuColor Me.hwnd, RGB(200, 220, 200), True 'Some kind of Green
    59. End Sub
    Last edited by jcis; Dec 10th, 2005 at 05:51 AM.

  7. #7
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: menu

    You can also get the "Internet Explorer Effect" by using this user control from vbAcceleartor.com.

    You can download the demo project and the OCX (that you need to register) from the navigation bar on the left of the page. If you search the site for "toolbar" you will get a ton of info on that control and how to use it, but the sample project is probably the most helpful.
    Last edited by eyeRmonkey; Dec 10th, 2005 at 01:32 PM.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

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