Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Visual studio question


  • Please log in to reply
3 replies to this topic

#1 Braydon Vaughan

Braydon Vaughan

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 16 August 2011 - 12:12 PM

In visual studio, I made a windows application is there any way that I can lock the window in the sense that the user cannot move it around?
  • 0

#2 CommittedC0der

CommittedC0der

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1065 posts
  • Programming Language:C#
  • Learning:C#, JavaScript, PL/SQL

Posted 16 August 2011 - 02:07 PM

I dont think there is property to set to fix this, but you could set the form back when someone try's to move it.
int xPos = 50; [COLOR=#006400] // x Locked position[/COLOR]
        int yPos = 50;  [COLOR=#006400]// y Locked position[/COLOR]
private void Form1_Move(object sender, EventArgs e)
        {
            this.Location = new Point(xPos, yPos);
        }

Good luck ~ Committed. :)
  • -1
There IS a war going on for your mind.
Nothing of eternal significance happens besides prayer.

#3 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 16 August 2011 - 02:10 PM

In the property of the form, set the FormBorderStyle to none... but this will remove the border
A other way to do so is with the Form1_LocationChanged event

Do something like this
 private void Form1_LocationChanged(object sender, EventArgs e)
        {
            this.Location = new Point(0, 0);
        }
where 0,0 is the position of your form
You didn't specify what language, this code is for c#, but the vb.net or c++ code will be very similar
  • -1

#4 Braydon Vaughan

Braydon Vaughan

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 17 August 2011 - 04:52 AM

Nevermind, all probems solved, thank you all for the help.

Edited by Braydon Vaughan, 17 August 2011 - 12:19 PM.

  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download