Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
GeneralRe: HTTPModule to filter .asp pages Pin
AWebDude25-Mar-04 10:13
AWebDude25-Mar-04 10:13 
GeneralRe: HTTPModule to filter .asp pages Pin
AWebDude25-Mar-04 10:35
AWebDude25-Mar-04 10:35 
GeneralRe: HTTPModule to filter .asp pages Pin
Heath Stewart25-Mar-04 10:41
protectorHeath Stewart25-Mar-04 10:41 
GeneralIt Worked !! HTTPModule to filter .asp pages Pin
AWebDude25-Mar-04 13:38
AWebDude25-Mar-04 13:38 
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 8:18
protectorHeath Stewart25-Mar-04 8:18 
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 8:36
protectorHeath Stewart25-Mar-04 8:36 
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 11:17
protectorHeath Stewart25-Mar-04 11:17 
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 11:40
protectorHeath Stewart25-Mar-04 11:40 
Your child control handles the parent's Resize event. You only override OnResize in the parent when you want the parent to resize the child controls, for example:
public class MyParent : Form
{
  private MyChild uc1;
  public MyParent()
  {
    // ...
    uc1 = new MyChild();
    uc1.Location = new Point(8, 8);
    uc1.Size = new Size(Width - 16, Height - 16);
    Controls.Add(uc1);
  }
  // ...
  protected override void OnResize(EventHandler e)
  {
    uc1.Size = new Size(Width - 16, Height - 16);
  }
}
public class MyChild : UserControl
{
}
This is a simple example of the parent resizing the child.

A simple example of the child resizing itself follows:
public class MyParent : Form
{
}
public class MyChild : UserControl
{
  protected override void OnParentChanged(EventArgs e)
  {
    if (Parent != null)
      Parent.Resize += new EventHandler(Parent_Resize);
  }
  private void Parent_Resize(object sender, EventArgs e)
  {
    this.Size = new Size(Parent.Size.Width - 16, Parent.Size.Height - 16);
  }
}
In both of these cases, the Anchor property is better suited. Just put the control in the right position and size it like you want it, then set the edges that you want to anchor to. Read about the Anchor property because the above code for something so simple that the anchoring functionality provides is a complete waste and the simple examples above don't take every condition into account.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 11:44
protectorHeath Stewart25-Mar-04 11:44 
GeneralRe: Resize Control at Design Time Pin
Jeremy Kimball25-Mar-04 13:05
Jeremy Kimball25-Mar-04 13:05 
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 13:44
protectorHeath Stewart25-Mar-04 13:44 
GeneralRe: Resize Control at Design Time Pin
Jeremy Kimball25-Mar-04 13:48
Jeremy Kimball25-Mar-04 13:48 
GeneralRe: Resize Control at Design Time Pin
Heath Stewart25-Mar-04 13:50
protectorHeath Stewart25-Mar-04 13:50 
GeneralRe: Resize Control at Design Time Pin
Jeremy Kimball25-Mar-04 14:06
Jeremy Kimball25-Mar-04 14:06 
GeneralQuestion about WebBrowser editing Pin
profoundwhispers25-Mar-04 6:54
profoundwhispers25-Mar-04 6:54 
GeneralRe: Question about WebBrowser editing Pin
Heath Stewart25-Mar-04 8:15
protectorHeath Stewart25-Mar-04 8:15 
GeneralUsing a #define from an unmanaged dll Pin
schnee2k325-Mar-04 6:42
schnee2k325-Mar-04 6:42 
GeneralRe: Using a #define from an unmanaged dll Pin
Dave Kreskowiak25-Mar-04 7:48
mveDave Kreskowiak25-Mar-04 7:48 
GeneralRe: Using a #define from an unmanaged dll Pin
schnee2k325-Mar-04 8:24
schnee2k325-Mar-04 8:24 
GeneralRe: Using a #define from an unmanaged dll Pin
Dave Kreskowiak25-Mar-04 8:31
mveDave Kreskowiak25-Mar-04 8:31 
GeneralRe: Using a #define from an unmanaged dll Pin
schnee2k325-Mar-04 8:36
schnee2k325-Mar-04 8:36 
GeneralRe: Using a #define from an unmanaged dll Pin
Jeremy Kimball25-Mar-04 7:49
Jeremy Kimball25-Mar-04 7:49 
GeneralRe: Using a #define from an unmanaged dll Pin
Andy Brummer25-Mar-04 9:28
sitebuilderAndy Brummer25-Mar-04 9:28 
GeneralStrongly typed hash-table Pin
peter271325-Mar-04 5:58
peter271325-Mar-04 5:58 
GeneralRe: Strongly typed hash-table Pin
Heath Stewart25-Mar-04 6:03
protectorHeath Stewart25-Mar-04 6:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.