Jump to content

Window with custom title bar


Go to solution Solved by JohnOne,

Recommended Posts

Edit: Now I'm going to expand the question, how do I create a custom title bar? So you have custom buttons (I already have those), but also have a part at the top, with which you can drag the window around. I don't need an icon or a title, so the only thing I need is this draggable part.

 

Original Question:

I want to make a GUI, which doesn't use the Windows buttons and has custom minimize/close-buttons.

But when I add the $WS_POPUP style to my GUI, and have the minimize button execute 

GUISetState(@SW_MINIMIZE)

the window has no minimize animation, where the window shrinks and retracts into the task bar.

Is there any way I can remove the border and the upper bar but still have the animation?

Thank you very much

Virhonestum (Vir)

Edited by virhonestum
Link to comment
Share on other sites

  • Moderators

virhonestum, it is just a tad difficult to troubleshoot the issue off a single line of code. How about providing your entire code, or at least a fair reproducer of the problem?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Sorry for the late response, but this the important part of what I'm currently working with:

#Include <GUIConstants.Au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Calculator = GUICreate("", 298, 100, 556, 260, $WS_POPUP)
GUISetBkColor(0xFFFFFF)
$Button_Exit = GUICtrlCreateLabel("×", 256, 0, 41, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0xDC0000)
GUICtrlSetColor(-1, 0xF2F2F2)
$Button_Minimize = GUICtrlCreateLabel("_", 224, 0, 25, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x1E1E1E)
GUICtrlSetColor(-1, 0xF2F2F2)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_Exit
            Exit
        Case $Button_Minimize
            GUISetState(@SW_MINIMIZE)
    EndSwitch
WEnd
Link to comment
Share on other sites

This is how it looks for me:

aa19cb9b22efdfc5a89124fd8023c649.gif

On this one the window just disappears

 

And this is how I want it (I removed the $WS_POPUP here)

cbf8acd3556c54700ddd386a7c4366da.gif

On this one it shrinks, fades out, and retracts to the task bar

Edited by virhonestum
Link to comment
Share on other sites

I picked this drag routine from the forums and use it a lot.  I cannot remember who posted it.

#Include <GUIConstants.Au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3> ; <---------------- Added
Global Const $SC_DRAGMOVE = 0xF012 ; <---------------- Added
$Calculator = GUICreate("", 298, 100, 556, 260, $WS_POPUP)
GUISetBkColor(0xFFFFFF)
$Button_Exit = GUICtrlCreateLabel("×", 256, 0, 41, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0xDC0000)
GUICtrlSetColor(-1, 0xF2F2F2)
$Button_Minimize = GUICtrlCreateLabel("_", 224, 0, 25, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x1E1E1E)
GUICtrlSetColor(-1, 0xF2F2F2)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_Exit
            Exit
        Case $Button_Minimize
            GUISetState(@SW_MINIMIZE)
    EndSwitch
    _SendMessage($Calculator, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; <---------------- Added
WEnd

This runs on my machine.  win8.1  64

REB

MEASURE TWICE - CUT ONCE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...