C#.NET Form Tricks

An interesting article titled Windows Forms Tricks You May Have Missed at CodeGuru.com

Trapping the Close “X” Button in a Form

Want to hide a form instead of closing it? Here’s a quick solution.

Resizing an MDI Child Form to Fit its Parent

Here’s a useful snippet for resizing an MDI child form to fit its parent, minus the title bar, menu bar, status bar and so on:

foreach (Control ctrl in MdiParent.Controls)
{
    if (ctrl is MdiClient)
    {
        Width = ctrl.ClientSize.Width;
        Height = ctrl.ClientSize.Height;
        break;
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: