I am trying to put a cool little image like this
For my split container drag button.
I do the following in the OnPaint Event
private void splitContainer1_Paint(object sender, PaintEventArgs e)
{
var control = sender as SplitContainer;
e.Graphics.DrawImage("...".Properties.Resources.divider, control.SplitterRectangle, 0, 0, 1040, 50, GraphicsUnit.Pixel);
}
It does draw the image as I would like, the problem is that the height is ALWAYS 4 pixels. In the designer I set the SplitterWidth to 15, but at runtime it always stays at 4. So, only 4 pixels actually shows up.
Yes, according to your comment, having the SplitterPanel
inside a TableLayoutPanel
does make the runtime forget the SplitterWidth
setting, so I did duplicate the problem. TableLayoutPanels
are weird creatures.
The unfortunately obvious work-around:
public Form1() {
InitializeComponent();
splitContainer1.SplitterWidth = 15;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With