Split button in .NET Winforms -
I'm looking for a split button in .NET WinForms. On one hand, there is a button on one side and a dropdown button on the other side
I see that they are used throughout the entire window, such as in the Save Studio window in Visual Studio, so I thought They have to control some libraries.
I know there is one for toolstrip, but I need to make it usable outside of ToolStripts.
Is there a Microsoft Library which is a free library or preferably? I am using .NET 3.5
For an example: < / P>
You can do a simple version of yourself using the image of the button. I have my own class which is taken from the button
.
I have the image set (like the down arrow):
{This.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; This.Image = YourResources.split_button; // Your Down-Arrow Image Text Image Relation = System Indoj. Forms Text image relayation. Text backwards; } Secure Override Zero OnClick (EventArgs e) {var Click Piece = this.PointToClient (New system, Drawing.Point (MousePosition.X, MousePosition.Y)); // If the click is higher than the right hand part of the button, then show the menu (clickPos.X> = (Size.Width - Image.Width)) ShowMenuUnderControl () and base.OnClick (e); } // If you want to click the mouse to right-click the mouse, then override the menu. Event protected override zero on-mouseup (mouse events event mevate) {if ((mevent.Button & MouseButtons.Right)! = 0) ShowMenuUnderControl (); Other Support OnMouseUp (mevant); } // Context Menu Increase Public ShowMenuUnderControl () {splitMenuStrip.Show (this, new point (0, this.Height), ToolStripDropDownDirection.BelowRight); }
If you want an icon in OP also, you can use the BackgroundImage
and the appropriate padding, such as:
< Code> this.BackgroundImageLayout = ImageLayout.None; this. Background Image = Your Resource. Button Icon; // Add padding so that the text can not overlay the background image. Padding = new padding (this.Padding.Lift + this.BackgroundImage.Width, this.Padding.Top, this.Padding.Right, this.Padding.Bottom);
My task has a button:
Comments
Post a Comment