Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I provide a standard 2-pixel 3D border in the non-client region of a custom control?

Override the custom control's CreateParams property as shown in this sample.

protected override CreateParams CreateParams 
{ 
  get 
  { 
    CreateParams cparams = base.CreateParams; 
    cparams.ExStyle &= ~512; 
    cparams.Style &= ~8388608; // WS_BORDER
    cparams.ExStyle |= 512; // WS_EX_DLGFRAME
    return cparams; 
  } 
}

Contributed from George Shepherd's Windows Forms FAQ



Page view counter