Click here to Skip to main content
15,860,972 members
Articles / Desktop Programming / MFC
Article

A snap to screen border dialog class

Rate me:
Please Sign up or sign in to vote.
3.71/5 (4 votes)
8 Apr 2000 101.1K   2.1K   24   10
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


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralVisual Studio Magazine... Pin
    Dave Kreskowiak11-Dec-08 8:31
    mveDave Kreskowiak11-Dec-08 8:31 
    Generalapp that makes all your windows snap Pin
    Ivan Heckman24-Apr-02 7:08
    Ivan Heckman24-Apr-02 7:08 
    GeneralMFC and Winamp Pin
    2-Mar-01 10:26
    suss2-Mar-01 10:26 
    GeneralThere are better ways.... Pin
    Member 147418-Apr-00 8:53
    Member 147418-Apr-00 8:53 
    GeneralRe: There are better ways.... Pin
    30-Oct-01 4:14
    suss30-Oct-01 4:14 
    GeneralRe: There are better ways.... Pin
    Todd Smith30-Oct-01 5:59
    Todd Smith30-Oct-01 5:59 
    GeneralRe: There are better ways.... Pin
    Jean-Claude25-Nov-02 0:47
    Jean-Claude25-Nov-02 0:47 
    QuestionWhat about SDI or MDI window? Pin
    Member 128710-Apr-00 16:43
    Member 128710-Apr-00 16:43 
    AnswerRe: What about SDI or MDI window? Pin
    Member 128710-Apr-00 16:46
    Member 128710-Apr-00 16:46 
    GeneralMy pet peeve... multimon support! Pin
    Member 45009-Apr-00 20:08
    Member 45009-Apr-00 20:08 

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

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