Windows.Forms SplitContainer.SplitterWidth will not be set at run time

I'm trying to put a cool little image like this

one of these guys

For my container drag and drop button.

I am doing the following in an 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 paints the image as I would like, the problem is that the height is ALWAYS 4 pixels. In the designer, I set SplitterWidth to 15, but at runtime it always remains at 4. Thus, only 4 pixels actually appear.

+5
source share
2 answers

Yes, according to your comment, the presence SplitterPanelinside a TableLayoutPanelmakes the runtime forget the parameter SplitterWidth, so I duplicated the problem. TableLayoutPanels- these are strange creatures.

Unfortunately, the obvious work:

public Form1() {
  InitializeComponent();
  splitContainer1.SplitterWidth = 15;
}
+7

, .

, splitContaner1 (child) panel1 (parent) , splitContaner1 ( ) . 1. , splitContaner1 1.

0

All Articles