| | |
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
Failure is not fatal, but failure to change might be. - John Wooden
•
•
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 |
.net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images inline insert intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial server soap sql table tcp text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






