Solved

Displaying a Button

Posted on 1998-12-09
4
214 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
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Implementing a ResolveEventHandler in C++ 13 115
How to copy an image file into clipboard C/C++? 1 152
c++ syntax question 9 44
White board coding practice 3 79
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

910 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

20 Experts available now in Live!

Get 1:1 Help Now