Click here to Skip to main content
13,048,027 members (73,965 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


8 bookmarked
Posted 12 Mar 2012

Resolution Free application using ResolutionFreePanel

, 12 Mar 2012
Rate this:
Please Sign up or sign in to vote.
This Panel is developed as a Custom Control. Place whatever the control on this panel, if resolution is changed then the controls position and the size is changed resolution


This control is developed form a Panel, but with some added functionality. This control provides Resolution free feature. Whatever the resolution user wants to see an application is provided by this control, the resolution is nothing but the monitor resolution. My monitors working range is 800*600 to 1600*1200. By using this control, I had tested by application and it is with standings for all the Resolution options. 

How it Works

The ResolutionFreePanel is derived from Panel class and it is developed as a User Control. I had used the SystemEvents.DisplaySettingsChanged event to modify the Size and Location of each controls which are placed on the ResolutiionFreePanel. For this control

DataBind(decimal dFactorWidth, decimal
dFactorHeight, Control objControl)
is the main function which performs all the Resolution free functionality.  First a  dummy Label object created. For this Label object modified the width, height, location values. Next used the DataBindings Property of the control to change the width, height, resolution of each control which is on the ResolutionFreePanel.

private void DataBind(decimal dFactorWidth, decimal dFactorHeight, Control objControl)
    if (objControl.Controls.Count > 0)
        foreach (Control objCtrl in objControl.Controls)
            objLabel.Width = (int)((decimal)objCtrl.Width * dFactorWidth);
            objLabel.Height = (int)((decimal)objCtrl.Height * dFactorHeight);
            objLabel.Location = new System.Drawing.Point((
                int)((decimal)objCtrl.Location.X * dFactorWidth),
                (int)((decimal)objCtrl.Location.Y * dFactorHeight));
            if (objCtrl.GetType() != typeof(System.Windows.Forms.SplitterPanel))
                objCtrl.DataBindings.Add("Width", objLabel, "Width");
                objCtrl.DataBindings.Add("Height", objLabel, "Height");
                objCtrl.DataBindings.Add("Location", objLabel, "Location");
            if (objCtrl.Controls.Count > 0)
                DataBind(dFactorWidth, dFactorHeight, objCtrl);


Using for Applications

This ResolutionFreePanel is provided as User Control.  When started your development, first place this control on the Form, then place whatever the control you want for your application. For testing purpose I had developed a form with n number of controls.

First screen is with 1600*1200 resolutions.

Next screen is with 1280*1024 resolutions.

Next screen is with 1024*768 resolutions.

And we can test the application by clicking the minimize and maximize  options of the Form also.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Vinay Swa
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
Sanjeeb3812-Feb-13 1:37
memberSanjeeb3812-Feb-13 1:37 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 12 Mar 2012
Article Copyright 2012 by Vinay Swa
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid