• Facebook
  • RSS Feed
  • Instagram
  • LinkedIn
  • Twitter
Oct 072011
 

First of all then I created a new Windows Forms App, which gives me a nice template from Visual Studio of a single form program.  I wanted to prevent the form being resizable, as I don’t plan to have code to automagically resize. 

To do this in the constructor for Form1() I do the following :

        public Form1()
        {
            InitializeComponent();
            Point NewLoc = Screen.FromControl(this).WorkingArea.Location;
            NewLoc.X += 1;
            NewLoc.Y += 1;
            this.Location = NewLoc;

            Size NewSize = Screen.FromControl(this).WorkingArea.Size;
            NewSize.Height -= 1;
            NewSize.Width -= 1;
            this.Size = NewSize;

            this.MinimumSize = this.Size;
            this.MaximumSize = this.MinimumSize;

 

I will still allow minimize, but I also turn off the maximize button since I’ve not made the form maximum size.  So I add the code :-

MaximizeBox = false;

I’ve also added a menu, and status bar.  Nothing exciting on them yet, other than File –> Exit.

The next things that I want to do is to have a button to press, somewhere, anywhere in the middle of the form which will :-

  • Get the current available window size (hoping to exclude the size of the menu and status bar)

After that I will start towards dynamically getting a list of images and adding image controls to hold them in a divided by rectangle.  To start down that road I will need to do the following I think :-

  • Add a single image control
  • Add an item to it

Then

  • Add two image controls programmatically
  • Add items to both of them

Then

  • Work out how to divide up the screen for say 6 images
  • Add the controls programmatically
  • Add items to each of the controls

Then

  • Work out how to divide the screen up for N images
  • Add the controls programatically
  • Add items to each of the controls

Finally

  • Integrate into Explorer in some way
    Time Spent So Far : 30 minutes
    References:

http://bytes.com/topic/c-sharp/answers/278649-how-do-i-prevent-form-resizing

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)