| | |
Do Not Move Form At Runtime + VB.Net
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 324
Reputation:
Solved Threads: 7
As u all know,at runtime we can move the form.
I use the foll. code,so dat form doesn't move.I want to ask dat is there any easy way to do it.
Mine code below working correctly,but lengthy-
I use the foll. code,so dat form doesn't move.I want to ask dat is there any easy way to do it.
Mine code below working correctly,but lengthy-
VB.NET Syntax (Toggle Plain Text)
Option Compare Text Option Strict On Option Explicit On Public Class Form1 Dim RCTransparentVerticalBar As Rectangle Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Make the fake caption rectangle RCTransparentVerticalBar = New Rectangle(0, 0, Me.Width, 29) End Sub Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) 'We want to pretend that the rectangle RCTransparentVerticalBar, is the caption bar so we can drag the form by it... If m.Msg = WM_NCHITTEST Then Call FakeCaptionForCaptionlessWindow(Me, m, RCTransparentVerticalBar) Else MyBase.WndProc(m) End If End Sub End Class ADD MODULE Option Strict On Option Explicit On Option Compare Text Module ModMoveForm Public Const WM_NCHITTEST As Long = &H84 Public Enum HitTestResult HTBORDER = 18 HTBOTTOM = 15 HTBOTTOMLEFT = 16 HTBOTTOMRIGHT = 17 HTCAPTION = 2 HTCLIENT = 1 HTERROR = (-2) HTGROWBOX = 4 HTHSCROLL = 6 HTLEFT = 10 HTMAXBUTTON = 9 HTMENU = 5 HTMINBUTTON = 8 HTNOWHERE = 0 HTRIGHT = 11 HTSYSMENU = 3 HTTOP = 12 HTTOPLEFT = 13 HTTOPRIGHT = 14 HTVSCROLL = 7 HTTRANSPARENT = (-1) HTOBJECT = 19 HTCLOSE = 20 HTHELP = 21 End Enum Public Sub FakeCaptionForCaptionlessWindow(ByVal fParent As Form, ByRef m As Message, ByVal CaptionRectangle As Rectangle) If m.Msg = WM_NCHITTEST Then '\\ If the mouse is in the rectangle that is considered to be the caption set the return value to HTCAPTION Dim ptClickLocation As New Point(m.LParam.ToInt32) ptClickLocation = fParent.PointToClient(ptClickLocation) If CaptionRectangle.Contains(ptClickLocation) Then m.Result = New IntPtr(HitTestResult.HTCAPTION) Else m.Result = New IntPtr(HitTestResult.HTCLIENT) End If End If End Sub End Module
0
#2 Oct 9th, 2009
Set FormBorderStyle
VB.NET Syntax (Toggle Plain Text)
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
•
•
Join Date: Aug 2009
Posts: 94
Reputation:
Solved Threads: 6
-1
#3 Oct 9th, 2009
•
•
•
•
Set FormBorderStyle
VB.NET Syntax (Toggle Plain Text)
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
![]() |
Similar Threads
- Login form in vb.net (VB.NET)
- Using a button in runtime (VB.NET)
- [VB.NET] How to add grip to the form? (VB.NET)
- hide/show part of form using client side code for ASP.NET (ASP.NET)
- error to bind textbox at runtime in vb.net 2003 (VB.NET)
- Simple Email Form in ASP.Net (ASP.NET)
- move previouse record in VB.net (VB.NET)
- How to code "tab control' in the web form in ASP.NET / VB.NET ? (ASP.NET)
- moving a form with no border (VB.NET)
Other Threads in the VB.NET Forum
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic beginner browser button buttons center checkbox client code convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms ftp generatetags gridview html images inline input insert intel internet lib listview mobile monitor net objects open panel passingparameters pdf picturebox port position print printing problem read remove save searchvb.net select serial settings shutdown soap sorting sqlserver survey table temperature textbox timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms wpf wrapingcode year






