473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Trouble with OnDraw function

Hi,
I try to display a simple text on the screen (MFC). I used
CMyAppView::OnDraw function but the application doesn't call it while
running. I tried to overload CMyAppView::OnUpdate(...) function and
inside call the OnDraw. The code looks like this:
void CMyAppView::OnUpdate(...)
{
//...//
CDC* pDC = GetDC();
this->OnDraw(pDC);
}
////////////////////////////////
void CMyAppView::OnDraw(CDC* pDC)
{
//...//
pDC->TextOut(1,1,"Display this text!");
}
And of course the OnDraw is now called but the TextOut don't display
anything!
The program does not generate any errors during compilation nor while
running, yet the text does no appear on the screen. Why is that and
what to do with it ?
Thanks in advance
Peter
Jul 22 '05 #1
2 2312
Peter wrote:
Hi,
I try to display a simple text on the screen (MFC). I used
CMyAppView::OnDraw function but the application doesn't call it while
running. I tried to overload CMyAppView::OnUpdate(...) function and
inside call the OnDraw. The code looks like this:
void CMyAppView::OnUpdate(...)
{
//...//
CDC* pDC = GetDC();
this->OnDraw(pDC);
}
////////////////////////////////
void CMyAppView::OnDraw(CDC* pDC)
{
//...//
pDC->TextOut(1,1,"Display this text!");
}
And of course the OnDraw is now called but the TextOut don't display
anything!
The program does not generate any errors during compilation nor while
running, yet the text does no appear on the screen. Why is that and
what to do with it ?
Thanks in advance
Peter

How did you add the function? The function needs to be bound to the
WM_PAINT message. If you use MSVC's built-in message handler wizard, it
will follow all the necessary steps to bind your function to the message
map. Otherwise, you'll have to do it manually.
Jul 22 '05 #2

"Peter" <ih******@op.pl> wrote in message
news:b9**************************@posting.google.c om...
Hi,
I try to display a simple text on the screen (MFC). I used
CMyAppView::OnDraw function but the application doesn't call it while
running. I tried to overload CMyAppView::OnUpdate(...) function and
inside call the OnDraw. The code looks like this:
void CMyAppView::OnUpdate(...)
{
//...//
CDC* pDC = GetDC();
this->OnDraw(pDC);
}
////////////////////////////////
void CMyAppView::OnDraw(CDC* pDC)
{
//...//
pDC->TextOut(1,1,"Display this text!");
}
And of course the OnDraw is now called but the TextOut don't display
anything!
The program does not generate any errors during compilation nor while
running, yet the text does no appear on the screen. Why is that and
what to do with it ?
Thanks in advance
Peter


This is a question about Windows programming not C++. You are off topic
here. Try a Windows programming group such as
news:comp.os.ms-windows.programmer.win32

john
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jacek Dziedzic | last post by:
Hi! First of all, I hope my problem is not too loosely tied to the "standard C++" that is the topic of this group. I have some code that exhibits a strange behaviour: on one computer, where I...
2
by: Jeff | last post by:
/* -------------------------------------------------------------------------- Hello, I was experimenting with class templates and specializing member functions and came across a simple problem...
0
by: bill | last post by:
I am building a single doc app. My document (View) has a number of controls and graphics on it. When I full window my frame all the controls and graphics disappear. Then when I resize my app they...
3
by: rufus | last post by:
This is wierd. I have a single doc app. I create some buttons in the view OnDraw method. When I size my app window - the buttons disappear. But as soon as I click on any spot inside the window...
1
by: ellieong | last post by:
Hi How do I pass a value let's say an integer value into the ondraw function, in order to vary the position of any drawing for instance a line? Ellie.
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
11
by: thierrydollar | last post by:
Hi, I have written a very simple program using variable arguments calls and I get strange things that I cannot explain. I have one function (add) that displays two parameters. It works well...
0
by: Tom Van Hauwaert | last post by:
I designed a font "WAG Symbols" that contains symbols in the private use area of unicode. Now I want to develop an insertable object that can handle these characters so they become visible in, let's...
0
by: Neelima35 | last post by:
Hi, I should append the polygons in the ondraw() screen reading the XML in vc6.0. The code is running without any errors but the ondraw() screen is left blank?
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.