Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove 3d border (sunken) from MDIClient component in MDI parent form?

Tags:

c#

.net

winforms

I am developing WinForms MDI app in VS2010 (.NET 4.0) and I just hate 3D border in MDI parent form.

So any ideas on how to remove it (make it flat or just no border it all) ?

like image 245
EmirZ Avatar asked Oct 13 '11 10:10

EmirZ


1 Answers

If you would prefer not to import external libraries there is also following cheat which repositions/resizes the mdi container control.

    protected override void OnLoad(EventArgs e)
    {
        var mdiclient = this.Controls.OfType<MdiClient>().Single();
        this.SuspendLayout();
        mdiclient.SuspendLayout();
        var hdiff = mdiclient.Size.Width - mdiclient.ClientSize.Width;
        var vdiff = mdiclient.Size.Height - mdiclient.ClientSize.Height;
        var size = new Size(mdiclient.Width + hdiff, mdiclient.Height + vdiff);
        var location = new Point(mdiclient.Left - (hdiff / 2), mdiclient.Top - (vdiff / 2));
        mdiclient.Dock = DockStyle.None;
        mdiclient.Size = size;
        mdiclient.Location = location;
        mdiclient.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
        mdiclient.ResumeLayout(true);
        this.ResumeLayout(true);
        base.OnLoad(e);
    }
like image 180
Paul Avatar answered Oct 05 '22 05:10

Paul