473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to Move form without titlebar

Hi Can any one tell me how to move a form without titlebar as we can use WIn
API in VB 6.0 is there any other method or xyz for the same

Sumit
Nov 20 '05 #1
4 2029
* "Sumit Gupta" <vi*******@hotmail.com> scripsit:
Hi Can any one tell me how to move a form without titlebar as we can use WIn
API in VB 6.0 is there any other method or xyz for the same


Basically no if you want Windows' standard behavior when moving the
window, so convert your declares and use p/invoke to archieve what you
want to do.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
On Tue, 27 Apr 2004 22:07:34 +0530, Sumit Gupta wrote:
Hi Can any one tell me how to move a form without titlebar as we can use WIn
API in VB 6.0 is there any other method or xyz for the same

Sumit


Override the WndProc method of your form to do it. Here is the code:

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Const WmNcHitTest As Integer = &H84
Const HtCaption As Integer = 2

If m.Msg = WmNcHitTest Then
m.Result = New IntPtr(HtCaption)
Else
MyBase.WndProc(m) 'THIS IS IMPORTANT!
End If
End Sub

--
Chris

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 20 '05 #3
Hi Sumit,

I got the idea this morning to change my region form sample,

I hope this helps?

Cor

\\\made by Cor Ligthert from ideas I got from Herfried. K. Wagner and Fergus
Cooney
Private WithEvents button1 As New Button
Private mouseX, mouseY As Integer
Private myMouseDown As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As New System.Drawing.Drawing2D.GraphicsPath
g.AddString("HTH" & vbCrLf & "Cor", _
System.Drawing.FontFamily.GenericSansSerif, _
System.Drawing.FontStyle.Bold, 200, _
New Point(0, 0), _
System.Drawing.StringFormat.GenericDefault)
Me.BackColor = Color.Red
Me.Region = New System.Drawing.Region(g)
g.Dispose()
Me.AutoScaleBaseSize = New System.Drawing.Size(0, 0)
Me.ClientSize = New System.Drawing.Size(500, 450)
button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
button1.ForeColor = System.Drawing.Color.Black
button1.Location = New System.Drawing.Point(425, 18)
button1.Size = New System.Drawing.Size(20, 20)
Me.Controls.Add(button1)
button1.Text = "X"
Me.Location = New System.Drawing.Point(50, 50)
End Sub
Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles button1.Click
Me.Close()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal _
e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
myMouseDown = True
mouseX = Cursor.Position.X - Me.Location.X
mouseY = Cursor.Position.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e _
As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMouseDown Then
Me.Location = New System.Drawing.Point(Cursor.Position.X _
- mouseX, Cursor.Position.Y - mouseY)
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
myMouseDown = False
End Sub
///
Nov 20 '05 #4
* "Cor Ligthert" <no**********@planet.nl> scripsit:
I got the idea this morning to change my region form sample,


Yep, I have implemented something similar, but this won't draw the neat
"outline" when moving the window.

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

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

Similar topics

6
by: develop | last post by:
Hi, Can a window be opened without a titlebar? Can an alert message box be opened without a titlebar and an OK button? I'm trying to display something like a tooltip when the onclick event...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
2
by: PC Datasheet | last post by:
I have a pop-up form with a combobox. In the form's open event I dropdown the combox's list. I have everything on the form locked down so the user can not collapse the combobox by clicking...
1
by: Tomomichi Amano | last post by:
How do I move a window without useing the titlebar (the blue bar on the top of the window). Thanks in advance
1
by: Iwan Petrow | last post by:
Hi, I have a windows form which is a MDI child. How can I forbid moving of the form? Thanks.
104
by: Colin McGuire | last post by:
Hi, is there a way to show a form without a titlebar (and therefore no control box/minimize box/title etc) but still have it appear looking like 3D? The property FormBorderStyle to None - this...
4
by: Sam Marrocco | last post by:
Is it possible to place controls such as a checkbox or button in the titlebar of a form? -- ================================================================== Sam J. Marrocco Sr. Visual...
1
by: JohnR | last post by:
I have a form that is presented in an mdi child window. If the user hits exit or the X button on the titlebar of the mdi child form, that form's "closing" event fires and in that event I check to...
1
by: hisree | last post by:
hi frnds i want full screen window without titlebar, i can use this script, var win =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...

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.