Results 1 to 1 of 1

Thread: Help with toolbar button dropdownmenu

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Radcliff, KY
    Posts
    3

    Help with toolbar button dropdownmenu

    im having a little problem getting the item i select from my toolbar dropdown menu to do what i want it to do.

    i want it to change the button text of the dropdownmenu to the selected item (in this case a font name)

    here is my code

    Code:
    Protected Sub toolBar1_ButtonDropDown(ByVal sender As Object, ByVal e As ToolBarButtonClickEventArgs)
            ' Evaluate the Button property of the ToolBarButtonClickEventArgs
            ' to determine which button was clicked.
    
            Select Case ToolBar1.Buttons.IndexOf(e.Button)
                Case 4
                    Dim docBox As RichTextBox = CType(ActiveControl, RichTextBox)
                    Dim currentFont As System.Drawing.Font = docBox.SelectionFont
                    Dim newFontStyle As System.Drawing.FontStyle
                    'below is whats is not working, i know its wrong, but 
                    'i dont know what to put here.  I need to get the font 
                    'name that was selected from the list and change 
                    'the .text property of button 4 to that font name.
                    ToolBar1.Buttons(4).Text = fonts.MenuItems.IndexOf (fonts)
                    docBox.SelectionFont = New Font(ToolBar1.Buttons(4).Text, currentFont.Size, newFontStyle)
                Case 5
    
            End Select
    End Sub

    this is in form_load

    Code:
    For Each ff In System.Drawing.FontFamily.Families
                Dim fontname As New MenuItem(ff.Name)
                fonts.MenuItems.Add(fontname)
    Next
    and this is public to the form
    Code:
    Dim fonts As New ContextMenu
    Dim fontsizes As New ContextMenu
    Dim ff As FontFamily
    if anyone can help with this i would very much appreciate it.
    Last edited by ultimage; Sep 10th, 2004 at 12:35 AM.

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