Minimize (and Not Maximize) options for borderless form

P

Phil Jones

I have a borderless WIndows Form.

I've found that with a borderless form the ContextMenu for the program
button in the task-bar is turned off. Upon advice from this list I can turn
it back on by overriding the CreateParams property like so:

Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Const WS_SYSMENU As Integer = &H80000
Dim oReturn As CreateParams = MyBase.CreateParams
oReturn.Style = oReturn.Style Or WS_SYSMENU
Return oReturn
End Get
End Property


The problem is, I end up with only the Maximize option enabled. I want the
reverse of this. To be able to minimize the form, and NOT maximize it.

I'm wondering, is this a problem with the setings in "CreateParams" or is it
a setting I need to make somewhere else.

Many thanks!
===
Phil
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Hi Phil,

You need to add one more style to the CreateParams.Style.
The new stile would be

WS_MINIMIZEBOX = 0x20000;

If you want to remove the maximize option from the menu you need to remove
the
WS_MAXIMIZEBOX = 0x1000

C# code for that is

cp.Style &= (~WS_MAXIMIZEBOX);

Simple altering of the MaximizeBox and MinimizeBox properties of the form
won't do
 
P

Phil Jones

Thanks Stoitcho!

Do you know if there is a list of all avaialble params (hex values) on MSDN
anywhere?

Cheers.
===
Phil
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Not in MSDN, though. I've seen web sites that people had listed them. I've
even seen a link to a program that a programmer in this newsgroup had made
where you can type the name of the constant and it gives you the hex value.
I guess if you google a bit you may find them.
What I presonally do is to go in the folder on my computer where VS.NET is
intalled and then go down into VC++ Platfrom SDK's 'Include' sub folder. On
my machine :
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
Almost all constant that you may need to use are decalred in winuser.h
header file.

If you need one that is not in this file you can find the header file in the
SDK (part of MSDN) documentation (usually it is on the bottom of the page
for this constant).
 

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

Top