Downloads  |  Buy

Splitter is not displayed

Splitter is not displayed

Postby nikunjbhatt84 » November 7th, 2012, 6:32 am

I am creating and assigning context menu dynamically to the SplitButton. I always want to display the splitter. But splitter is only displayed when mouse is hovered on the SplitButton.

I have code as following:

Public Class Main
Dim ContextMenu1 As New ContextMenu

Private Sub btnAddMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
With ContextMenu1
.MenuItems.Add("&New", New System.EventHandler(AddressOf btnAdd_Click))
.MenuItems.Add("&Edit", New System.EventHandler(AddressOf btnEdit_Click))
.MenuItems.Add("&Remove", New System.EventHandler(AddressOf btnRemove_Click))
End With
SplitButton1.SplitMenu = ContextMenu1
'SplitButton1.ContextMenu = ContextMenu1
SplitButton1.ShowSplit = True
End Sub
End Class
User avatar
nikunjbhatt84
 
Posts: 3
Joined: November 7th, 2012, 6:13 am
Location: Bhavnagar, India.

Re: Splitter is not displayed

Postby Sam » November 7th, 2012, 2:19 pm

Yes, we figured this was the best behavior when we designed it. You can modify the code to show the splitter all the time.
User avatar
Sam
 
Posts: 3126
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Re: Splitter is not displayed

Postby nikunjbhatt84 » November 7th, 2012, 2:53 pm

@sam
I tried changing some code but it didn't worked. Can you please suggest where and what should I change in the source?
User avatar
nikunjbhatt84
 
Posts: 3
Joined: November 7th, 2012, 6:13 am
Location: Bhavnagar, India.

Re: Splitter is not displayed

Postby nikunjbhatt84 » November 7th, 2012, 3:10 pm

I just realized that SplitButton.ShowSplit is slightly different thing than what I had assumed and its value is by-default True. So, it is of no use in my above code. I had tried changing some "ShowSplit" lines in source code but now I think it is not directly related to what I want.

So, please tell me where the code should be altered to achieve my desired effect.
User avatar
nikunjbhatt84
 
Posts: 3
Joined: November 7th, 2012, 6:13 am
Location: Bhavnagar, India.

Re: Splitter is not displayed

Postby Wyatt » November 10th, 2012, 12:58 am

Look in the OnPaint method and you'll see how the UI is drawn. Just add breakpoints to understand it all, and then modify it once you've understood it.
User avatar
Wyatt
Site Admin
 
Posts: 6053
Joined: July 11th, 2007, 10:30 pm
Location: New Hampshire


Return to Open Source Support