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
Solved

Displaying a Button

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
c++ how to tell if the progra is ctl or mfc atl ect 6 84
IdTelnet1DataAvailable handler freezes the Application 4 84
C++ question 3 70
Dialogbox API leak? 18 98
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…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

856 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