My mfc program draws the following shape in the client area- now i want to place a button next to this for rearrangement of the shape.
I know i can use a toolbar or a menu button, but is there a way i can place a button right next to the box? something like this:

All you need to do is create a
CButton, and position it appropriately.Note that the button is only created once and takes care of drawing itself. You do not need to worry about it in
OnDraw()or anything like that.The only time you need to worry is when the button should move position. This is why I separated out the
RepositionButton()function. For instance, if you are using aCScrollViewand the user scrolls, the button window has no knowledge of this, so you will need to react to scroll events and callRepositionButton()You can react to the button’s messages just like you would any other button by adding an
ON_BTN_CLICKEDmessage map.