| | |
Custom Splitbuttons, Arrow lost.
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 4
Reputation:
Solved Threads: 0
Hey everyone im trying to finish up my custom renderers for menustrip toolstrip and statusstrip but when i override the OnRenderSplitButtonBackground the dropdown arrow dissapears here is my code
I cant seem to figure out how to get back, anyone can help me? thanks
C# Syntax (Toggle Plain Text)
protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e) { if (e.Item.Selected) { Rectangle rectBorder = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1); Rectangle rect = new Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1); LinearGradientBrush b = new LinearGradientBrush(rect, clsClrs.clrSelectedBG_White, clsClrs.clrSelectedBG_Header_Blue, LinearGradientMode.Vertical); GraphicsPath path = new GraphicsPath(); path = clsClrs.FillRoundedRectangle(e.Graphics, rect.X, rect.Y, rect.Width, rect.Height, 8); e.Graphics.FillPath(b, path); clsClrs.DrawRoundedRectangle(e.Graphics, rectBorder.X, rectBorder.Y, rectBorder.Width, rectBorder.Height, 8, clsClrs.clrToolstripBtn_Border); } //base.OnRenderSplitButtonBackground(e); }
I cant seem to figure out how to get back, anyone can help me? thanks
Hello, phantom8l.
This can be interesting for you: Manually painting a ToolStripSplitButton
This can be interesting for you: Manually painting a ToolStripSplitButton
So what if you can see the darkest side of me?
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
very simple solution, just use GDI+ to draw a new arrow 
at the end just throw in
specify the points as needed. since you only pass 3 points you get a triangle, if two points have the same Y value, and the third point's x value is half way between the first 2 X values then you get a downward facing arrow, which I think is what you want.
now Im not sure what look you were going for so I didn't put in any values here, but I am sure if you are custom drawing your own controls you will be able to figure out the points yourself.
Best of luck.
Alternatively, the actual reason that the arrow isn't drawn is because you override the method that calls the method that draws it. called "drawarrow" from the base class, here is an excerpt from the code on the link that Antenka posted above me.

at the end just throw in
//e.Graphics.FillPolygon(Brushes.Black, new Point[]{new Point(x, y), new Point(x, y), new Point(x,y)});specify the points as needed. since you only pass 3 points you get a triangle, if two points have the same Y value, and the third point's x value is half way between the first 2 X values then you get a downward facing arrow, which I think is what you want.
now Im not sure what look you were going for so I didn't put in any values here, but I am sure if you are custom drawing your own controls you will be able to figure out the points yourself.
Best of luck.

Alternatively, the actual reason that the arrow isn't drawn is because you override the method that calls the method that draws it. called "drawarrow" from the base class, here is an excerpt from the code on the link that Antenka posted above me.
C# Syntax (Toggle Plain Text)
class MyRender : ToolStripRenderer { protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e) { base.OnRenderSplitButtonBackground(e); ToolStripSplitButton item = e.Item as ToolStripSplitButton; base.DrawArrow(new ToolStripArrowRenderEventArgs(e.Graphics, item, item.DropDownButtonBounds, SystemColors.ControlText, ArrowDirection.Down)); } }
Last edited by Diamonddrake; Sep 29th, 2009 at 4:43 pm.
•
•
Join Date: Sep 2009
Posts: 4
Reputation:
Solved Threads: 0
ahhh-ha thats exactly what i was looking for thank you for taking the time to search for that for me, i tried searching everywhere but couldnt describe what i was lookin for also thanks for the very fast reply
![]() |
Similar Threads
- Lost Windows XP user password (Windows NT / 2000 / XP)
- how to delete extra commas on csv file with php (PHP)
- sorting in a custom grid view (ASP.NET)
- sorting in a custom control- a grid view (ASP.NET)
- Custom Ecommerce (eCommerce)
- Lost 500 photos on iPhoto OX10.3.9. Help! (Mac Software)
- Us Staffing-custom Application Engineer (Tech / IT Consultant Job Offers)
- Hyperlinks In Outlook Express (Windows NT / 2000 / XP)
Other Threads in the C# Forum
- Previous Thread: dataGridView.ClearSelection Except current cell
- Next Thread: Control of UserControl components from another form
Views: 462 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption event excel file files form format forms ftp function gdi+ httpwebrequest image index input install java label list listbox listener login math mouseclick mysql networking object operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





