An Example of Overlapping Controls (CRgnedButton)

Whenever a developer wants to create overlapping controls for example a Button with inner buttons, or a slider inside it, he faces a problem that whenever a user clicks on the button inner items disappear. I found a simple solution for this problem, which also prevents any distortions in the drawing if the inner controls.

Using this special button control is very simple, just use the ClassWizard to subclass your button to a CRgnedButton class typed control, and start overlapping it with what ever you want. (Of course don't forget to include the header file and cpp file, CRgnedButton.h & CRgnedButton.cpp accordingly)

To manually add a CRgnedButton to your existing Dialog do the following:

Add to your Dialog control the following (after adding a visual Button, using the Visual Editor):

  • To the Dialog's header file:
    #include "RgnButton.h"
    
  • (under the Dialog class)
    CRgnButton	m_Btn1;
    
  • To the Dialog's cpp file:
    (under the Dialog DoDataExchange)
    DDX_Control(pDX, IDC_BUTTON1, m_Btn1);
    

Downloads

Download demo project & source code - 36 KB



Comments

  • Overlaping Of Buttons(Active x control with buttons)

    Posted by Legacy on 04/05/2003 12:00am

    Originally posted by: vishala

    Hi,
    This is nice working,But My problem is how we done same thing for an active x control and buttons.Example I takke a media palyer control on that control i place buttons in the place of position controls,when a button click it is it's functionality with out disappear control.It is Important for me.
    regards
    vishala

    Reply
  • Doubt regarding CBitmapButtons

    Posted by Legacy on 10/16/2002 12:00am

    Originally posted by: anu

    hi,

    i have some CBitmapButtons in the view window.when i click one bitmapbutton it is fixed in a particular position. i want the same bitmapbutton to appear in a different position too. how to add functionality twice and how to make it understand that the first click is for one position and the second click is for other position?

    Reply
  • Doesn't work in Windows 95

    Posted by Legacy on 10/18/2000 12:00am

    Originally posted by: Harry

    I built the code using VC++ 6.0 sp4 and it ran great on
    Windows 98, NT & 2000. But it doesn't work in Windows 95.
    Just alot of screen flicker. Any ideas anyone?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • The impact of a data loss event can be significant. Real-time data is essential to remaining competitive. Many companies can no longer afford to rely on a truck arriving each day to take backup tapes offsite. For most companies, a cloud backup and recovery solution will eliminate, or significantly reduce, IT resources related to the mundane task of backup and allow your resources to be redeployed to more strategic projects. The cloud - can now be comfortable for you – with 100% recovery from anywhere all …

  • With JRebel, developers get to see their code changes immediately, fine-tune their code with incremental changes, debug, explore and deploy their code with ease (both locally and remotely), and ultimately spend more time coding instead of waiting for the dreaded application redeploy to finish. Every time a developer tests a code change it takes minutes to build and deploy the application. JRebel keeps the app server running at all times, so testing is instantaneous and interactive.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds