Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASAP : Problems with OnPaint

Status
Not open for further replies.

coolbass

Programmer
Nov 7, 2002
11
0
0
PH
Good day guys

im creating a dialog-based program and i need my dialog box to draw lines.

my problem is, i want to have a white rectangular box and inside it i want to overlap it with line graph.

everytime WM_PAINT occurs, the rectangle i made overrides the previous line so i dont see the whole line graph instead i see the last line drawn after the execution of OnPaint().

Please help me!!

For short, i want have a line graph with white rectangular box everytime i get data. Real-time acquisition of data is needed in this project, and i want to graph this data using the OnPaint().

thanks.
 
Try storing your graph in a CBitmap object and redraw it each time you OnPaint() is called
 
the whole line graph in a CBitmap format?

is there another way.....

tnx
 
>> is there another way.....

DirectX and Open GL are other ways but it think the old Device Context method as mentioned by EoF81 is probably sufficient for your needs. [wink]

Do some research on Win32 BitBlt() and "Memory Device Context" and/or "Double Buffering".

-pete
 
can you give some simple programs that i can use as reference aside from the documentation of BitBlt?
 
As you receive real time input data. Save it to an array that you will use to display your scope trace. Everytime you refresh your scope, redraw all the data by accessing the array.

Hope this helps.
 
bcravens,

im new in VC++ but i can manage to create an array. my problem is, how can redraw it usng CBitmap? can u give me some simple source code about this?

tnx
 
Just redraw the data trace and it's background in the OnPaint() handler.

That is what the Scribble application that palbano does.
 
>> Just redraw the data trace and it's background in the OnPaint() handler.

Sure that would work. However if the data is only ever written and no deletions take place it would be more efficient to have a memory bitmap that you continue to update as data arrives and then BitBlt() the bitmap to the screen DC.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top