Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A snap to screen border dialog class

0.00/5 (No votes)
8 Apr 2000 1  
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