Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Displaying a Button

Posted on 1998-12-09
4
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

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

Accepted Solution

by:
The_Brain earned 100 total points
ID: 1179753
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
ID: 1179754
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
ID: 1179755
You will have to do the work of painting the button youself.  That means using BeginPaint and EndPaint etc.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

610 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