By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

make a window unmovable

P: n/a
how do i make a window unmovable so its locked in place
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

You will either have to reset the position of your form in the OnMove event
Or simply take make the form BorderStyle NONE and the control box false.

Hope this helps.
rawCoder

"savage" <sa****@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
how do i make a window unmovable so its locked in place

Nov 20 '05 #2

P: n/a
Remove the Border by setting the border style to none

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"savage" <sa****@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
how do i make a window unmovable so its locked in place

Nov 20 '05 #3

P: n/a
* =?Utf-8?B?c2F2YWdl?= <sa****@discussions.microsoft.com> scripsit:
how do i make a window unmovable so its locked in place
From my FAQ:

Based on an implementation written by Tom Spink.

The code below defines a base class that provides a 'Moveable' property.
By inheriting from this class and setting the 'Moveable' property to
'False', the user will be prevented from moving then form:

\\\
Imports System.ComponentModel
Imports System.Windows.Forms

Public Class MoveableForm
Inherits Form

Private Const WM_NCLBUTTONDOWN As Int32 = &HA1
Private Const WM_SYSCOMMAND As Int32 = &H112

Private Const HTCAPTION As Int32 = &H2

Private Const SC_MOVE As Int32 = &HF010

Private m_Moveable As Boolean

Public Sub New()
MyBase.New()
Me.Moveable = True
End Sub

< _
Category("Behavior"), _
Description("Allows the form to be moved.") _ _

Public Property Moveable() As Boolean
Get
Return m_Moveable
End Get
Set(ByVal Value As Boolean)
m_Moveable = Value
End Set
End Property

Protected Overrides Sub WndProc(ByRef m As Message)
If Not m_Moveable Then
If _
m.Msg = WM_SYSCOMMAND And _
m.WParam.ToInt32() = SC_MOVE _
OrElse _
m.Msg = WM_NCLBUTTONDOWN And _
m.WParam.ToInt32() = HTCAPTION _
Then
Return
End If
End If
MyBase.WndProc(m)
End Sub
End Class
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.