Click here to Skip to main content
Licence 
First Posted 8 Apr 2000
Views 79,667
Bookmarked 23 times

A snap to screen border dialog class

By | 8 Apr 2000 | Article
Dialog class that implement a snap-to-screen-border feature like Winamp
  • Download demo project - 14 Kb
  • Download source files - 2 Kb
  • Introduction

    This class is used to implement the same feature seen in the popular Winamp player. With this class you are able to snap the dialog to the screen border. If you drag the dialog near the screen border, the dialog will automatically stick on the screen border (like a magnet).

    How to use it

    1. Add SnapDialog.h and SnapDialog.cpp to your project.
    2. Add #include "SnapDialog.h" in your dialog class.
    3. Replace all occurrence of CDialog in your dialog class by CSnapDialog.
    4. Enjoy!

    To change the limit after which the dialog is automatically stickled to the screen border, set these two variables. Default values are 15 pixels.

    m_nXOffset = 15;
    m_nYOffset = 15;
    

    That's all!

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    François Gagné



    United States United States

    Member



    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board. (secure sign-in)
     
    Search this forum  
     FAQ
        Noise  Layout  Per page   
      Refresh
    GeneralVisual Studio Magazine... PinmvpDave Kreskowiak8:31 11 Dec '08  
    Generalapp that makes all your windows snap PinmemberIvan Heckman7:08 24 Apr '02  
    GeneralMFC and Winamp PinmemberBob H10:26 2 Mar '01  
    GeneralThere are better ways.... PinsussEric Tetz8:53 18 Apr '00  
    GeneralRe: There are better ways.... PinmemberAnonymous4:14 30 Oct '01  
    GeneralRe: There are better ways.... PinmemberTodd Smith5:59 30 Oct '01  
    GeneralRe: There are better ways.... PinsussJean-Claude0:47 25 Nov '02  
    QuestionWhat about SDI or MDI window? PinsussDmitry Sokolov16:43 10 Apr '00  
    AnswerRe: What about SDI or MDI window? PinsussDmitry Sokolov16:46 10 Apr '00  
    GeneralMy pet peeve... multimon support! PinsussTom Spilman20:08 9 Apr '00  
    As like Winamp this thing does not work 'as expected' on a multimon system. Lookup MonitorFromWindow and GetMonitorInfo. Use them to snap to the edges of the monitor the window is in most. To

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Mobile
    Web03 | 2.5.120528.1 | Last Updated 9 Apr 2000
    Article Copyright 2000 by François Gagné
    Everything else Copyright © CodeProject, 1999-2012
    Terms of Use
    Layout: fixed | fluid