Home > Software engineering >  Who help to take a look at, where is the problem! About CPaintDC and OnPain
Who help to take a look at, where is the problem! About CPaintDC and OnPain

Time:09-25




Steel began to learn MFC programming
To achieve a renju boards!

In OnLButtonDown, click left key of mouse, can realize

Change to the OnPaint, failed to achieve, after the operation, the board of line for a moment, direct window hang!!!

CPaintDC classes, in OnPain, should how to implement, who can give me about, thank you

CodePudding user response:

You modify the value of the tag in the OnLButtonDown response function (for example, record the coordinates of points), and then call the refresh function InvalidateRect/Invalidate () () to refresh,
OnPaint draw

CodePudding user response:

1, based on the CView class reloading ontouch , in which the map
Draw a line 2 should be elected to the appropriate brush before

CodePudding user response:

reference 1st floor VisualEleven response:
you modify the value of the tag in the OnLButtonDown response function (for example, record the coordinates of points), and then call the refresh function InvalidateRect/Invalidate () () to refresh,
OnPaint map

Because is a novice, you said, is not too understand! Can help us continue to answer?
Need to implement the drawing, and OnLButtonDown has nothing to do, I'm OnLButtonDown realize this code, to verify, realizes the mapping logic code is correct!
In the OnPaint, is to want to let the window initialization, can display board!
After the program is running, can appear in an instant the board, and then refresh back white

Because the first contact CPaintDC, don't know how to use! You said the InvalidateRect ()/Invalidate () don't know which function is the use!

CodePudding user response:

I mean you OnLButtonDown coordinate the position of the pieces in the function, and then call Invalidate ()/InvalidateRect () to refresh,
OnPaint function to Draw the Draw board first, then the Draw pieces,

CodePudding user response:

"1, based on the CView class reloading ontouch, in which the map"
OnPaint to invoke ontouch, you draw results are covered in ontouch,
  • Related