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

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds