SizeableToolWindow

M

mick

I tried asking this in the windowsforms group but there seems
to be very little life there.

I want to create a little window that has the thick border you
get when you set the FormBorderStyle to SizeableToolWindow
bit I dont want it to be sizable (similar to the Volume Control on
Win 7). I have set the MaximumSize property to prevent sizing
but the cursor still changes to the resize cursor when it hits the
border. How do I stop that happening?

mick
 
P

Peter Duniho

mick said:
I tried asking this in the windowsforms group but there seems
to be very little life there.

I want to create a little window that has the thick border you
get when you set the FormBorderStyle to SizeableToolWindow
bit I dont want it to be sizable (similar to the Volume Control on
Win 7). I have set the MaximumSize property to prevent sizing
but the cursor still changes to the resize cursor when it hits the
border. How do I stop that happening?

Does FormBorderStyle.FixedDialog or FormBorderStyle.Fixed3D not create a
non-resizable window drawn the way you want?

If not, while I'm afraid I don't have a specific answer, I have some
other ideas.

It's been awhile, so I don't recall if there are specific window style
flags that would allow this in unmanaged code. But if there are, you
can override the CreateParams property in your Form sub-class and set
the appropriate flags that will keep the thick border but set it to
non-resizable.

This would be the closest "pure .NET" solution I think might work. And
you'll still have to look up the specifics on the style flags that might
control that in the unmanaged Win32 API docs.

If there are no such flags, then you may have to create your own
unmanaged window class that draws a thick border but which isn't
resizable. Using this approach, again you would have to override
CreateParams. But in that case, rather than just manipulating the style
flags, you'd have to set the window class name property to the window
class you want to use (being sure, of course, to have your window class
extend the normal window class used in a Form; assuming .NET uses a
named, registered window class of course…I don't recall off the top of
my head if it does).

Personally, if I had a window that needed to be non-resizable, I'd just
use one of the border styles that is non-resizable and be done with it,
even though it might not be exactly the appearance I was hoping for. :)
Doing all that work just to get the window border to draw a specific
way seems like a big waste of time, time you could spend on much more
important things.

I mean, really…just how important could having an exact border style be? :)

Pete
 
M

mick

Peter Duniho said:
Does FormBorderStyle.FixedDialog or FormBorderStyle.Fixed3D not create a
non-resizable window drawn the way you want?

No, none of these do it.
If not, while I'm afraid I don't have a specific answer, I have some
other ideas.

It's been awhile, so I don't recall if there are specific window style
flags that would allow this in unmanaged code. But if there are, you
can override the CreateParams property in your Form sub-class and set
the appropriate flags that will keep the thick border but set it to
non-resizable.

This would be the closest "pure .NET" solution I think might work. And
you'll still have to look up the specifics on the style flags that might
control that in the unmanaged Win32 API docs.

Thanks for the pointer. I`ll have a look into this.
If there are no such flags, then you may have to create your own
unmanaged window class that draws a thick border but which isn't
resizable. Using this approach, again you would have to override
CreateParams. But in that case, rather than just manipulating the style
flags, you'd have to set the window class name property to the window
class you want to use (being sure, of course, to have your window class
extend the normal window class used in a Form; assuming .NET uses a
named, registered window class of course…I don't recall off the top of
my head if it does).

Personally, if I had a window that needed to be non-resizable, I'd just
use one of the border styles that is non-resizable and be done with it,
even though it might not be exactly the appearance I was hoping for. :)
Doing all that work just to get the window border to draw a specific
way seems like a big waste of time, time you could spend on much more
important things.

I mean, really…just how important could having an exact border style be? :)

No it`s really just a cosmetic thing, I liked the look and was looking for how
to do it. It`s certainly not critical:) although I will try and found out how to do
it - it just won`t be a priority:)

Thanks again,

mick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Modal Forms 2
Bug in 2008 8
Dialog still resizeable? 2
VBA set thick borders around non empty cells in range 0
Form Icon 8
WinForm Resize 2
Paragraph Border Question 3
Checking cursor type 2

Top