65.9K
CodeProject is changing. Read more.
Home

A snap to screen border dialog class

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.71/5 (4 votes)

Apr 9, 2000

viewsIcon

102022

downloadIcon

2141

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!