Skip to content

GroophyLifefor/ResponsiveForm

Repository files navigation

ResponsiveForm

Responsive

In many reason winforms are not responsive, so i felt compelled to do this.

NET Framework(like 4.8)

Do not support anymore.

NET(like NET5, NET6)

Install-Package Responsive

Sizing (Responsive/Sizing.cs)

Without Initalized.

withoutSizing

Actually, really bad I don't use any dock because dock too not a good way I think.

When you call just Sizing Class like

private void Form1_Load(object sender, EventArgs e)
{
    Sizing sizing = new Sizing(this);
}

JustCallSizing

Yes, that's much worse, I must to change something, or? adding some feature?

If I able to connect controls to controls as side by side? like

private void Form1_Load(object sender, EventArgs e)
{
    Sizing sizing = new Sizing(this);
    sizing.CreateNewConnection(richTextBox1, menuStrip1, Sizing.MarginSection.Top);
    sizing.CreateNewConnection(button1, richTextBox1, Sizing.MarginSection.Top);
    sizing.CreateNewConnection(button2, button1, Sizing.MarginSection.Top);
    sizing.CreateNewConnection(button3, button2, Sizing.MarginSection.Top);
    sizing.CreateNewConnection(button4, richTextBox1, Sizing.MarginSection.Top);
    sizing.CreateNewConnection(button4, button1, Sizing.MarginSection.Left);
    sizing.CreateNewConnection(numericUpDown1, richTextBox1, Sizing.MarginSection.Top);
    sizing.CreateNewConnection(numericUpDown1, button3, Sizing.MarginSection.Left);
    sizing.CreateNewConnection(treeView1, richTextBox1, Sizing.MarginSection.Left);
    sizing.CreateNewConnection(treeView1, Sizing.MarginSection.Right);
    sizing.CreateNewConnection(richTextBox1, Sizing.MarginSection.Bottom);
    sizing.CreateNewConnection(button1, Sizing.MarginSection.Bottom);
    sizing.CreateNewConnection(button2, Sizing.MarginSection.Bottom);
    sizing.CreateNewConnection(button3, Sizing.MarginSection.Bottom);
    sizing.CreateNewConnection(button4, Sizing.MarginSection.Bottom);
}

connections

WithConnections

Yeah, Really better

MoveForm (Responsive/MoveForm.cs)

WinForm gives you a MenuBar which you can move, put title, minimalize, maximize, close. But not so effective. (I was inspired by Spotify UI) spotify

Without Initalized.

Withoutmoveform

Lets try something You can do everything which WinForm gives you and you can do more.

Steps

  • Create Panel which will be custom MenuBar
MoveForm moveForm = new MoveForm(this, panel1);

Withmoveform Maybe you see laggy reason of you see in a gif, but really smooth

  • If you want customize your MenuBar
  • Put three button which will be minimalize, maximize, close
LoadButtons(
   Form MainForm,                         // Your Form usually 'this'
   Control MinimalizeBtn,                 // Your Minimalize Control(usually Button)
   Control SizingChangeBtn,               // Your Maximize/Normalize Control(usually Button)
   Control CloseBtn,                      // Your Close Control(usually Button)
   bool JustHideFormWhenClose = false)    // true  -> Hide Form when tried Close
                                          // false -> Close all of application

Actually I don't wanted use Form but I must use Form because I need WindowState property

MoveForm moveForm = new MoveForm(this, panel1);
moveForm.LoadButtons(this, minBtn, maxBtn, closeBtn);

Withbuttons

I record in setted values so you don't see full screen, But maximize works fine.

Really going better!

Resizer (Responsive/Resizer.cs)

Without Initalized.

withoutResizer

WinForm give you resize your form but when FormBorderStyle = None, You can not resize your form as you can see top.

With Initalize

Actually do not do anything with just initalize. You must to call some methots

LoadMouseHook

Resizer resizer = new Resizer();
resizer.LoadMouseHook(this);

withmousehook

Your project's interface may not be able to support smaller or larger than an amount. So you can set Resize limit.

ResizeLimit

resizer.LoadResizeLimits(this, new Resizer.ResizeLimits()
            {
                minWidth = 600,
                minHeight = 500,
                maxWidth = 1200,
                maxHeight = 800
            });

withreizelimit

Some distortions occur and these distortions are corrected with minor resizes, my goal is to fix them completely.

Final Project

final

Spotify Demo UI

Made for just Responsive UI not able to play music or else. Some info about demo

  • minHeight = 680, minWidth = 735
  • Two Menubar reason of two color
  • Two Sizing which Form and PlaylistPanel as (picture, state, name, author, time)

finalspotify

  • Thanks to JETBRAINS and MICROSOFT!

About

Responsive UI in winform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages