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

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • On-demand Event Event Date: September 17, 2014 Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this webcast and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the future state of your servers, …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds