Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, January 8, 2009 5:58 AM
Dear Friend,
Any one can tell me How to create resizable window without title bar ? (important thing in the Task bar Form name should display)
I tried like below.
form.ControlBox = false;
form.Text = "";
form.FormBorderStyle = FormBorderStyle.Sizable;
Is there any other method to create resizable window without title bar and Form name should be displayed in the Task bar ?
Thanks
Regards
Kirankumar S
All replies (9)
Thursday, January 8, 2009 7:07 PM âś…Answered | 1 vote
Leave the ControlBox, Text and FormBorderStyle properties at defaults during DesignTime and remove the WS_CAPTION style in a CreateParams override:
protected override CreateParams CreateParams |
{ |
get |
{ |
CreateParams cp = base.CreateParams; |
cp.Style &= ~0xC00000; //WS_CAPTION; |
return cp; |
} |
} |
Mick Doherty
http://dotnetrix.co.uk
Thursday, January 8, 2009 6:22 AM | 1 vote
You will have to make some kind of area the user kan click and drag to resize the form, and then set the size of the form in code yourself Ole - Andre Johansen | Hire Me !
Thursday, January 8, 2009 9:39 AM | 1 vote
Add a label to the StatusStrip and set its Text property to the form's name. Set SizingGrip to true.
Friday, January 9, 2009 4:26 AM
What is the difference of Mick Doherty's answer and setting the Form's FormBorderStyle property to none? How do you resize the Form? What feature does the StatusStrip lack?
Friday, January 9, 2009 4:41 PM | 1 vote
JohnWein said:
What is the difference of Mick Doherty's answer and setting the Form's FormBorderStyle property to none? What feature does the StatusStrip lack?
Although the op had typed StatusBar, I knew that they meant TaskBar by understanding exactly what the code supplied was doing.
TaskBar and StatusBar/StatusStrip are not the same thing. TaskBar is where you will find the Start Button and where a TaskButton is displayed for your Form/Forms unless the forms ShowInTaskBar property is set to false. This TaskButton will show it's associated Forms Text value as it's Text, but in order to remove the TitleBar from the form using the original method provided, you must set the Text property to an empty string resulting in no Text being displayed in the TaskButton. By Removing the WS_CAPTION style when the form is created, we end up with a form with no TitleBar but which still has a Text value for the TaskButton to display.
JohnWein said:
How do you resize the Form?
So long as you select a Sizeable FormBorderStyle you will still have a sizing border on the form and so the form is still resizeable.Mick Doherty
http://dotnetrix.co.uk
Friday, January 9, 2009 5:58 PM
I might have thought he meant TaskBar also, if he had typed StatusBar, but he typed StatusStrip. I should have realized that since the StatusStrip did everything he was asking, he meant something else. I'm easily confused.
Tuesday, January 20, 2009 9:11 AM
Dear Friend,
i used Mick Doherty code.
if i maximize the window ,the window is not maximizing properly. There is some space in the right side edge.
i have this problem in Windows Vista but no problem in Windows XP.
Thanks
Regards
Kiran S
Tuesday, February 2, 2010 9:03 AM
Modifying the window style via CreateParams does not make the taskbar button appear on initial load. The user has to activate another window, then re-activate the target window before the taskbar button appears.
Any reason why this is so? How do you workaround this?
Tuesday, February 2, 2010 6:04 PM
I'm not seeing that behaviour.
Have you changed any properties of the Form?
Have you modified the Createparams Style in any way other than shown in my example?
For more examples you may wish to look into my Form Tips:
http://dotnetrix.co.uk/form.htm
Mick Doherty
http://dotnetrix.co.uk