Windows Develop Bookmark and Share   
 index > Windows Forms General > Resize of nested control
 

Resize of nested control

Hi,

I have control inherited from UserControl (userControl1).

This control contains ComboBox (comboBox1).

comboBox1.Anchor = AnchorStyles.Left | AnchorStyles.Right;

userControl1 situated on panel (wlPane), that is part of WeifenLuo DockPanel Suite.

userControl1.Anchor=AnchorStyles.Left | AnchorStyles.Right;

________________

| wlPanel |

| _____________ |

| |userControl1 | |

| | __________ | |

| | |comboBox1 | | |

| ||__________| | |

| |_____________| |

|________________|

When I resize wlPanel, userControl1 resizes correct, but comboBox1 becoming larger than userControl1.

I know that problem is in wlPanel, but I don't understand, how it can affect on size of comboBox1, if comboBox1

is private member of userControl1?

Any ideas are welcome.

OrSol  Thursday, September 13, 2007 2:05 PM

Hi OrSol,

Try to set your UserControl’s AutoScaleMode property to AutoScaleMode.None, and this will solve your problem.

Code Snippet

SimpleSample

public partial class UserControl1 : UserControl

{

public UserControl1()

{

InitializeComponent();

this.AutoScaleMode = AutoScaleMode.None;

}

}

Best regards.
Rong-Chun Zhang.

Rong-Chun Zhang  Tuesday, September 18, 2007 5:05 AM

Hi OrSol,

I cannot reproduce your problem. When you resize wlPanel , the combobox will became larger, but it is still smaller than userControl1. You can make userControl1 with a different color to see what will happen when you resize wlPanel.

When you resize wlPanel, according to the Anchor of userControl1, the size of userControl1 will be changed. When userControl1 resized, combobox will changed its size according to its Anchor.

Best regards.
Rong-Chun Zhang.

Rong-Chun Zhang  Monday, September 17, 2007 3:31 AM

Thnaks,for Your attention.

I create simple solution, that reproduce problem:

http://www.bookmaker.dnt.md/SimpleSample.zip

Also, I found, that when Font property of sets to Tahoma, 11 the all works normal, but only with that Font.

Still trying to find right solution..

OrSol  Monday, September 17, 2007 9:15 AM

Hi OrSol,

Try to set your UserControl’s AutoScaleMode property to AutoScaleMode.None, and this will solve your problem.

Code Snippet

SimpleSample

public partial class UserControl1 : UserControl

{

public UserControl1()

{

InitializeComponent();

this.AutoScaleMode = AutoScaleMode.None;

}

}

Best regards.
Rong-Chun Zhang.

Rong-Chun Zhang  Tuesday, September 18, 2007 5:05 AM

You can use google to search for other answers

Custom Search

More Threads

• PropertyGrid - max length in cell.
• How test if client machine have .NET framework
• TreeView mouse rightclick highlight problem
• help in windows service
• Complicated Custom DataGridView Question with example.
• Shift drawn line on control resize...?
• Popup Window not Responding
• Need help with Composite Application Block
• Unable to change the backcolor of the menu strip.
• Changing control's property -> Repaint!