How to Disable Maximize on Fixed Tool Window Form

mohsinjk

Member
Joined
Aug 1, 2007
Messages
11
Programming Experience
1-3
Hi;
When we change the form border style to Fixed tool window then on double click in form title bar he become Maximized. I want to disable this functionality.

reply me soon.:confused:
 
Also,
JohnH's code works great...

One thing I noticed was when you double click on the title bar, it makes the "x" box flicker. Is there any explanation for that? I'm going to play with it a little. :D
 
Last edited:
Here is a ghetto solution:

VB.NET:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Me.WindowState = FormWindowState.Maximized Then
            Me.WindowState = FormWindowState.Normal
        End If
    End Sub

Put that in a timer w/ a small interval. ;)

That's worse than doing the same thing in the Resize event, at least the Resize event gives immediate results every time, plus it doesn't have the program using a timer which is using system resources for a simple task. Sorry if I sound rude.

JohnH's code does the trick, it completely suppresses the Maximize message to any windows with that code.

A very nice fix, how did you come up with that code anyways?
 
A very nice fix, how did you come up with that code anyways?
It's described in the Window Features article I linked, just about everything concerning windows handling at a lower level than VB.Net normally touches, if you coded C++ this stuff should be much familiar, also more advanced classic VB (VB6) programmers used much Win32 functionality because there was not a Framework available like we have today with .Net. The test code is standard Win32 PInvoke calls, the applications message loop goes through WndProc. In earlier VB days this was called subclassing and was used to change windows (read: forms and controls) since there was no inheritance and much class properties and their internals was not available to the developer. Win32 code with VB.Net should be avoided if Framework already provide the same functionality in its library, I think, usually does that mean .Net wraps standard calls without errors in a safe matter for us to easily use and saves us time and problems.
 
Back
Top