473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inhibiting form movement

Is there a way to inhibit moving the form on screen?
Thank you,
Adrian.
Jul 15 '07 #1
2 1114
Hi Adrian,

Presumably, something like this should work:

public class Form1 : Form {
Point location;

protected override void OnShown(EventArgs e) {
base.OnShown(e);
location = this.Location;
}

protected override void OnMove(EventArgs e) {
base.OnMove(e);
if(!this.Location.Equals(location)) {
this.Location = location;
}
}
}

On 15 jul, 09:47, "Adrian <" <x...@xx.xxwrote:
Is there a way to inhibit moving the form on screen?
Thank you,
Adrian.

Jul 15 '07 #2
Thank you very much.
Adrian.

"Bram" <b.*****@gmail.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
Hi Adrian,

Presumably, something like this should work:

public class Form1 : Form {
Point location;

protected override void OnShown(EventArgs e) {
base.OnShown(e);
location = this.Location;
}

protected override void OnMove(EventArgs e) {
base.OnMove(e);
if(!this.Location.Equals(location)) {
this.Location = location;
}
}
}

On 15 jul, 09:47, "Adrian <" <x...@xx.xxwrote:
Is there a way to inhibit moving the form on screen?
Thank you,
Adrian.


Jul 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most...
8
by: Ralph Freshour | last post by:
Is it possible to inhibit the browser Back/Fwd buttons via PHP? Thanks...
1
by: Rocky A | last post by:
I don't remember ever reading about this in any of the "how to" books I've got or I wouldn't bother you guys (honest, I'm not being lazy here.....OK maybe just a little, but you guys are SOOOO...
1
by: John | last post by:
Hi all: I have an application that hides itself and displays an icon in the system tray. Is it possible for this application to detect keystrokes and/or mouse movements while hidden/minimized....
1
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
1
by: sircool | last post by:
hi guys, the problemm is that you have a horse on the chess board.You should write a function that calculate the horse's movement.I mean how many movement later you can go every point on the board.I...
2
by: BurtonBach | last post by:
I have a form with two subforms. Is there a way to control how the Tab key moves between fields? Especially those movement from field to field between subforms for data entry?
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
6
by: c.k. | last post by:
I was wondering if there was a way to give mouse movement on an empty form some lag/delay? For instance, user moves mouse, and the cursor is 20ms (possible adjustable from some option) behind the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.