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

  • Savvy enterprises are discovering that the cloud holds the power to transform IT processes and support business objectives. IT departments can use the cloud to redefine the continuum of development and operations—a process that is becoming known as DevOps. Download the Executive Brief DevOps: Why IT Operations Managers Should Care About the Cloud—prepared by Frost & Sullivan and sponsored by IBM—to learn how IBM SmartCloud Application services provide a robust platform that streamlines …

  • Event Date: April 15, 2014 The ability to effectively set sales goals, assign quotas and territories, bring new people on board and quickly make adjustments to the sales force is often crucial to success--and to the field experience! But for sales operations leaders, managing the administrative processes, systems, data and various departments to get it all right can often be difficult, inefficient and manually intensive. Register for this webinar and learn how you can: Align sales goals, quotas and …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds