0
votes

I have a form with a splitcontainer. One of the panels in the splitcontainer then loads a user control. This user control contains a combobox with the following properties changed from default:

  1. DrowdownStyle=DrowDownList
  2. FlatSyle=flat
  3. Anchor=top,left,right

When the form and user control load, the combobox looks as expected:

However, if I resize the splitcontrol, it starts looking weird. If I increase the size of the panel that holds the control, this happens:

enter image description here

If i decrease the size of the splitter, it looks less weird, but still not how it is supposed to:

enter image description here

In either case, the combobox starts looking normal once I mouse over it.

Here is my code:

Main Form:

//Main form. Has a split container created from the toolbox
public partial class SampleForm:Form
{
    public SampleForm()
    {
        InitializeComponent();
        SampleControl cntrl = new SampleControl();
        splitContainer1.Panel1.Controls.Add(cntrl);
        splitContainer1.BorderStyle = BorderStyle.FixedSingle;
        cntrl.Dock = DockStyle.Fill;
    }
}

User Control:

//User control. Has a combobox created from toolbox. Options as described    above
public partial class SampleControl : UserControl
{
    public SampleControl()
    {
        InitializeComponent();
    }
}

How can I fix this problem?

1

1 Answers

0
votes

May be try to set dock to None . Also try to fix the margin for control