Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line separators in VB6 menu

Status
Not open for further replies.

seba18

Programmer
Jul 26, 2004
38
How can I put line separators (horivontal lines) between two menu commands in a VB6 menu?
 
Easy peasy...
in Menu Editor you might have
Edit (menu group name)
.....Cut )
.....Copy ) Your first group of commands
.....Paste )

(for a separator just add)

.....- (that's a minus sign in the Caption and call it bar or separator in the name box)

Hope this helps

Demonic
 
Thank's for your answer. It works!

I have another question: how can I write bold text in a menu?
 

seba18:
if u wanna make only one menu item bold, here is the code. usually u have ur default menu item set to bold.

Code:
'**************************************
'Windows API/Global Declarations
'**************************************

Private Declare Function GetMenu Lib "user32" ( _
    ByVal hwnd As Long) As Long

Private Declare Function GetSubMenu Lib "user32" ( _
    ByVal hMenu As Long, _
    ByVal nPos As Long) As Long

Private Declare Function SetMenuDefaultItem Lib "user32" ( _
    ByVal hMenu As Long, _
    ByVal uItem As Long, _
    ByVal fByPos As Long) As Long


'**************************************
'Funtion/Sub Definitions
'**************************************

Public Sub SetBold(frmForm As Form, iMenuPos As Long, iItemPos As Long)
    'frmForm [in]: parent form name of menu
    'iMenuPos [in]: position of menu, starting from 0
    'iItemPos [in]: position of submenu, starting from 0
    Dim hMnu As Long, hSubMnu As Long
    hMnu = GetMenu(frmForm.hwnd)
    hSubMnu = GetSubMenu(hMnu, iMenuPos)
    Call SetMenuDefaultItem(hSubMnu, iItemPos, 1&)
End Sub

call that sub like this, e.g. Call SetBold(Me, 1, 2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top