|
-
Feb 6th, 2003, 09:45 PM
#1
Moveable...? [Resolved]
Is there a way to make a form unmoveable in .NET?
Last edited by crptcblade; Feb 7th, 2003 at 09:18 AM.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 6th, 2003, 10:11 PM
#2
Addicted Member
Code:
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
Form1.ActiveForm.Width = 200
Form1.ActiveForm.Height = 200
End Sub
You can do it this way but there probably is a better way.
-
Feb 6th, 2003, 10:26 PM
#3
I was hoping for a more unflickery way (provided you really meant to use OnMove, otherwise I have no idea where you are going). I could set the borderstyle to None, but I would rather not. Thanks anyway.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 6th, 2003, 10:29 PM
#4
Originally posted by crptcblade
I was hoping for a more unflickery way (provided you really meant to use OnMove, otherwise I have no idea where you are going). I could set the borderstyle to None, but I would rather not. Thanks anyway.
umm can you do it in vb6? maybe someone could help you convert the APIs to .NET
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 6th, 2003, 10:33 PM
#5
Originally posted by MrPolite
umm can you do it in vb6? maybe someone could help you convert the APIs to .NET
VB6 is easy. Moveable = False at design time .
The only other way I know to do it is to remove the Move option from the system menu of the form. Anybody want to point in the right direction?
I'd rather work the actual code out for myself, seeing as how I'm trying to get used to all this .NET malarky. Just a nice push will do.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 7th, 2003, 07:37 AM
#6
Sleep mode
well , you have either use this flickry code or to to make your
form's border style to none and create your own titlebar.
VB Code:
Dim LastLocation As Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
LastLocation = Me.Location
End If
End Sub
Private Sub Form1_Move(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles MyBase.Move
Me.Location = LastLocation
End Sub
-
Feb 7th, 2003, 07:39 AM
#7
Well, that sucks. But if I must, then I must.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 7th, 2003, 08:04 AM
#8
Sleep mode
I know it's silly but If you could overcome that flickring , it would be great .
-
Feb 7th, 2003, 08:11 AM
#9
Well, I hacked it a bit. I overrode the WndProc method of the form and checked for a left mouse down message on the titlebar. If I get it, then I cancel the message.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 7th, 2003, 04:54 PM
#10
Originally posted by crptcblade
Well, I hacked it a bit. I overrode the WndProc method of the form and checked for a left mouse down message on the titlebar. If I get it, then I cancel the message.
can you post your code anyways ?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 7th, 2003, 05:12 PM
#11
Sure...
Code:
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Dim i As IntPtr = New IntPtr(0)
Dim cap As IntPtr = New IntPtr(HTCAPTION)
If (m.Msg.Equals(WM_NCLBUTTONDOWN)) And (m.WParam.Equals(cap)) Then
m.Result = i
Exit Sub
End If
MyBase.WndProc(m)
End Sub
It could probably stand to be cleaned up a little, but it works.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|