473,385 Members | 1,311 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,385 software developers and data experts.

Moving forms without caption bars

I have a form with the FormBorderStyle = None, i.e. no caption bar, no
borders. But I'd still like to have the possibility to move this form by
using the mouse. Could anybody tell me what to implement to accomplish this?

Thanks!

Bevo
Nov 16 '05 #1
2 5664
Hello, "Bevo"
I have a form with the FormBorderStyle = None, i.e. no caption bar, no
borders. But I'd still like to have the possibility to move this form by
using the mouse. Could anybody tell me what to implement to accomplish this?


You can dispatch WM_NCHITTEST message and tell to Windows that user clicks on caption. Simply override WndProc method:

protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0084) //WM_NCHITTEST
{
base.WndProc(ref m);

if (m.Result == (IntPtr)1) //HTCLIENT. User clicks on the window client area
{
m.Result = (IntPtr)2; //HTCAPTION. Now it's caption
}
}
else
{
base.WndProc(ref m);
}
}

Nov 16 '05 #2
Hi,

Well, that depend of what mouse action you want to be interpreted as a
"move window" action.

I think that winamp as a similar thing, if you click and drag the window it
does move it.
You can handle these events accordinly.

Then you may use Form.Location to reflect the mouse movement.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bevo" <Be**@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
I have a form with the FormBorderStyle = None, i.e. no caption bar, no
borders. But I'd still like to have the possibility to move this form by
using the mouse. Could anybody tell me what to implement to accomplish
this?

Thanks!

Bevo

Nov 16 '05 #3

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

Similar topics

2
by: Greg Bacchus | last post by:
Hi, I'm getting an exception that really has me stumped. It's sporadic at best, it's only happened a handful of times. This particular time it happened when the user pressed 'Alt-S' to save the...
2
by: Deborah V. Gardner | last post by:
I am using Access 97. I would like to be able to pause between forms. For example, I have 2 reminders I would like displayed separately, one at a time. Here is part of the code I am using. If...
5
by: tina.boroff | last post by:
Hello Everyone, I have a database that I am plodding through (new user) and have an issue. I have a form that has combo boxes that look up data from another table. However, if the data (insurance...
5
by: MLH | last post by:
Now I see things like frmLookUpAvehicle (and other form names) in the title bars on the forms. Can I change all to the string returned by GetAppNameNver() in an automated process from the...
0
by: Sam Sungshik Kong | last post by:
Hello! If I understand correctly, MouseMove event is triggered when the mouse moves (ie when point changes). I, however, found out that it's triggered even if the mouse is not moving. What I...
4
by: Steve Barnett | last post by:
I've created a simple MDI application and have designated the Window menu to keep track of the mdi children. When I first load an mdi child, it's caption consists of "File: no file loaded" and this...
8
by: Tony K | last post by:
How do you maximize a child form when you show the child form. My resolution on my screen is 1440 x 900. My parent form maximizes just fine, but when I show a child form it doesn't maximize. It...
0
by: kloplop321 | last post by:
I found this code(vb only) and it does about the same thing(in vb, not vb .NET 2005) Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute...
0
by: Peted | last post by:
hello ive got a MDI form(with borders) and am opening a childform inside, that shows without any borders and needs to be sized exactly to the visible area in the mdi form, inside the borders. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.