473,667 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Movable property...

Hello,

How to prevent user from moving the form at run time. At
the same time, I want to keep my control box and form
border.

Thanks,
Douglas ^^

Nov 20 '05 #1
10 9642
You'll have to create a new class which inherits from form, then make all
your forms inherit from this new form. Here is the class:

<WatchForWrappi ng>

Public Class MovableForm
Inherits System.Windows. Forms.Form

Private m_blnMovable As Boolean

Private Const WM_NCLBUTTONDOW N As Integer = &HA1
Private Const WM_SYSCOMMAND As Integer = &H112
Private Const HTCAPTION As Integer = &H2
Private Const SC_MOVE As Integer = &HF010

Public Sub New()
MyBase.New()
m_Movable = True
End Sub

<System.Compone ntModel.Categor y("Behavior") ,
System.Componen tModel.Descript ion("Allows the form to be moved")> _
Public Property Movable() As Boolean
Get
Return m_blnMovable
End Get
Set(ByVal Value As Boolean)
m_blnMovable = Value
End Set
End Property

Protected Overrides Sub WndProc(ByRef m As Message)

If Not m_blnMovable Then
If m.Msg = WM_SYSCOMMAND And m.WParam.ToInt3 2 = SC_MOVE Then
Return
If m.Msg = WM_NCLBUTTONDOW N And m.WParam.ToInt3 2 = HTCAPTION
Then Return
End If

MyBase.WndProc( m)

End Sub
End Class

</WatchForWrappin g>

This adds a Movable property to your form. Set it to false and the form
cannot be moved. The property will appear in the property browser under the
'Behavior' section. Remember: The forms you would like to have this property
must inherit from MovableForm, and the project must be built after you
create this class before your forms can inherit from it. Go into the code
and change the Inherits line of your form. Just to be safe, build your
project then view the form in the Designer, and play with your Movable
property.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
"Hello" <do*********@te xwinca.com> wrote in message
news:07******** *************** *****@phx.gbl.. .
Hello,

How to prevent user from moving the form at run time. At
the same time, I want to keep my control box and form
border.

Thanks,
Douglas ^^

Nov 20 '05 #2
Cor
Douglas,
This works for me
\\\\\\\\
Private Sub Form1_Move(ByVa l sender As Object, ByVal e As System.EventArg s)
Handles MyBase.Move
MyBase.Location = New System.Drawing. Point(30, 30)
End Sub
/////////
Cor
Nov 20 '05 #3
Hi Tom,

Nice one, I reckon I can use that sometime - It's going into my
snippets collection. Thanks.

What is the tag <WatchForWrappi ng> </WatchForWrappin g> for ?
You've used it before I seem to remember.

Regards,
Fergus


Nov 20 '05 #4
OE will wrap lines to 78 chars when posting a response, so anything enclosed
in <WatchForWrappi ng> tags should be looked at to make sure a line hasn't
wrapped, or if it has to correct piece the line back together.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
"Fergus Cooney" <fi******@tesco .net> wrote in message
news:u3******** ******@TK2MSFTN GP09.phx.gbl...
Hi Tom,

Nice one, I reckon I can use that sometime - It's going into my
snippets collection. Thanks.

What is the tag <WatchForWrappi ng> </WatchForWrappin g> for ?
You've used it before I seem to remember.

Regards,
Fergus


Nov 20 '05 #5
Thanks Tom,

Wouldn't it be nice to have a tag to tell OE <not> to wrap.

And to have OE not flag for attention my own posts

And to have OE....

Regards,
Fergus
Nov 20 '05 #6
Hello,

"Fergus Cooney" <fi******@tesco .net> schrieb:
Nice one, I reckon I can use that sometime - It's going into my
snippets collection. Thanks.
I *hate* unmoveable windows.
What is the tag <WatchForWrappi ng> </WatchForWrappin g> for ?
You've used it before I seem to remember.


Depending on the settings of the newsreader sending the message, text will
be automatically wrapped aftet ~80 characters.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #7
> I *hate* unmoveable windows.

So do I, but I love programming ;-)
Depending on the settings of the newsreader sending the message, text will
be automatically wrapped aftet ~80 characters.
I found a setting for this in OE, to wrap text after 'n' characters

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
"Herfried K. Wagner [MVP]" <hi*******@m.ac tivevb.de> wrote in message
news:OY******** ******@tk2msftn gp13.phx.gbl... Hello,

"Fergus Cooney" <fi******@tesco .net> schrieb:
Nice one, I reckon I can use that sometime - It's going into my
snippets collection. Thanks.


I *hate* unmoveable windows.
What is the tag <WatchForWrappi ng> </WatchForWrappin g> for ?
You've used it before I seem to remember.


Depending on the settings of the newsreader sending the message, text will
be automatically wrapped aftet ~80 characters.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet

Nov 20 '05 #8
Hi Herfried,

|| I *hate* unmoveable windows.

When I've finished KillerApp 2000 (due for release in 2006). I'll
be adding some special code to detect when it's your machine. It'll
let you move the window anywhere you like, but when you run it again,
it'll have forgotten. Haha.

Doh!, silly me, that's already standard behaviour these days.

|| I *hate* unmoveable windows.

Me too, but I think there may be a place for Tom's snippet in an
MDI app. ??

Regards,
Fergus.
Nov 20 '05 #9
> I love programming too.

;-)
Ditto.
I know about this setting, but I do not change its value (currently 76
characters).
Ditto.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
"Herfried K. Wagner [MVP]" <hi*******@m.ac tivevb.de> wrote in message
news:OH******** ******@TK2MSFTN GP12.phx.gbl... Hello,

"Tom Spink" <th**********@n tlworld.com> schrieb:
I *hate* unmoveable windows.


So do I, but I love programming ;-)


I love programming too.

;-)
Depending on the settings of the newsreader sending the message, text will be automatically wrapped aftet ~80 characters.


I found a setting for this in OE, to wrap text after 'n' characters


I know about this setting, but I do not change its value (currently 76
characters).

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet

Nov 20 '05 #10

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

Similar topics

0
1617
by: sean | last post by:
I'm having problems trying to sort a series of authors who post online using Movable Type. I've tried posting my problem to the Movable Type support group, but no one has even answered my question. So either it can't be done, or no one cares to respond. In any case, as some of you might know, Movable Type is a PHP developed site, so I'm hoping that there might be an answer using stricly PHP and not MT's tools. Below is my original...
0
1906
by: Fuzzyman | last post by:
Movable Python has just been released on sourceforge. Movable Python is a frozen distribution of Python. It will run python scripts without needing to be installed. http://sourceforge.net/projects/movpy http://www.voidspace.org.uk/python/movpy Fancy trying out Python 2.4 without installing it ? Want a distribution of python you can carry around on a flash card ? Need to test scripts with several versions of python ? Movable Python may...
1
1951
by: Mircea | last post by:
How I can create a movable component, for example a button, in run-time? Thanks
2
2927
by: Ryan Ternier | last post by:
Hello, I'm looking at creating an application that allows users to create their own templates, and thought of using the same idea's MS used when creating http://sympatico.my.msn.com/. I looked at the source, JS files and everything else referenced with those pages, and it still left more confused that when I start. Does anyone know any sites that touch on movable divs that can be customized like MS allows you to customize...
0
1560
by: Fuzzyman | last post by:
It's finally happened, `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ is finally released. Versions for Python 2.3 & 2.4 are available from `The Movable Python Shop <http://voidspace.tradebit.com/groups.php>`_. The cost is £5 per distribution, payment by PayPal. £1 from every distribution goes to support the development of `SPE <http://pythonide.stani.be/>`_, the Python IDE.
1
1256
by: loga123 | last post by:
Hi All, I am using ASP .NET 2.0. I have gridview displaying data and when a row is selected on gridview "detailsview" pops up based on the row selected from gridview. I want to make this "detailsview" movable as we do with "windows". How can we achieve this? Thx
3
1932
gauravgmbhr
by: gauravgmbhr | last post by:
hello friends can some one tell me plz can I create a movable as well as resizable html component using javascript plz help me or email me some link that can be helpfull for me
3
2159
by: anniejacob | last post by:
hi, i dragged dynamic labels from 1panel to other then once that label is placed on other panel i want that label 2 b movable on run time. my form is in C# can u help me with this bye
1
1474
by: trint | last post by:
How can I add movable windows to my c# dotNet web app? Do I have to convert the whole thing to AJAX or is it even known how Google does this? Thanks, Trint
0
8457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8788
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8646
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.