Solved

Displaying a Button

Posted on 1998-12-09
4
211 Views
Last Modified: 2010-04-02
I created a button class in classwizard that inherits from CButton. I then displayed it by calling create. However, when I override OnPaint(), it no longer displays the
button. Calling CButton::OnPaint() does not seem to help. What must I do? Thanks.
0
Comment
Question by:stin
  • 2
4 Comments
 
LVL 22

Expert Comment

by:nietod
Comment Utility
What is the code you have in OnPaint?  Do you call BeginPaint and EndPaint?
0
 
LVL 1

Accepted Solution

by:
The_Brain earned 50 total points
Comment Utility
That is because you inherited it... Or you overrode the very funtion that actually does the work onpaint.  (you did use classwizard. didn't you?  
You must actually declare the thing you want displayed once you override this function.  
(i think, tell me if this is the problem, I don't have time to check. I gonna sleep now.)
0
 

Author Comment

by:stin
Comment Utility
I did override OnPaint() using classwizard.  I did not call BeginPaint() or EndPaint(), I simply wanted to change the font.  What I'm trying to do is read a list of strings from a DB and then create an array of buttons, one for each string.  I created an array of buttons, and called Create() for each of the buttons.  This seemed to work fine.  Then, when I overrode OnPaint() using classwizard my buttons disappeared.  How can I change the font while also keeping the default OnPaint() functionality?  Thanks
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
You will have to do the work of painting the button youself.  That means using BeginPaint and EndPaint etc.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now