|
-
April 13th, 1999, 03:19 PM
#1
How to create this button
I have standard Doc/View application with the view class derived from CScrollview. I have loaded a 256 color bitmap on the entire client area. I'd like to add a small CButton object on the client area ( on top of the bitmap). How can I achieve this without creating additional dialog box. Thank you very much for your help.
-
April 13th, 1999, 04:22 PM
#2
Re: How to create this button
Just call the API CreateWindow(), CreateWindowEx(), or MFC's CWnd::Create() with the class name as "BUTTON". Look in the Help for the various button styles.
Regards,
Paul McKenzie
-
April 13th, 1999, 08:10 PM
#3
Re: How to create this button
Hi, to create a Button, first create a CButton member variable in CYourView class.
CButton m_button;
and in CYourView::OnInitialUpdate add this
void CYourView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CRect rect(0,0,70,30); //size and position of your button
m_button.Create("Test", BS_PUSHBUTTON, rect, this, 0);
m_button.ShowWindow(SW_SHOW);
}
I used BS_PUSHBUTTON style, but you can use whatever you need, just take a look to "Button Styles" in the documentation.
The font used to write "Test", is the current font selected in the device-context, so you can change it to whatever font you want.
Fabian
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|