| |

VerySource

 Forgot password?
 Register
Search
View: 1019|Reply: 4

I would like to draw a rectangular frame on the image, how can I make the image refresh (refresh) without causing the im

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-15 09:00:02
| Show all posts |Read mode
As the mouse moves, draw a rectangular frame from the starting point to the ending point on the image. I record the starting point in MOUSEDOWN, and then draw the rectangle from the starting point to the mouse position in MOUSEMOVE, but I find that a multilayered rectangle is drawn, I Now I just want to draw a rectangle from the starting point to the position of the mouse, and it changes with the movement of the mouse. In this way, I added the Refresh (); to the MOUSEMOVE event for synchronous refresh. But the image flickered fiercely due to the constant refresh.
Excuse me, are there any 2 ways? Not only does the image refresh synchronously, so that it does not produce unnecessary stacked rectangles, but
Do not let the image flicker. How can I do this? ? Thank you
Reply

Use magic Report

0

Threads

16

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-4-14 22:45:01
| Show all posts
Don't use refresh, the rectangle is just a simple figure, you can completely redraw it with pmxor to erase the original picture, that is to say, in onmove you should write the original rectangle rect with pmxor once, erase, and then in pmcopy It seems to be this, you look at the help, the default) to draw new coordinates, if you design a complex figure, you can use double buffering for simplicity, first draw it in memory, and then display it, the display part is directly in onpaint Just call the corresponding function like copyrect.
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-7-11 12:15:01
| Show all posts
doublebufer=true of the parent container of image
Reply

Use magic Report

0

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-7-12 11:00:01
| Show all posts
Use DrawFocusRect to draw a rectangle in MouseMove.Its function is similar to xor.The first time it is drawn, the second time is equivalent to erasing.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-21 00:00:01
| Show all posts
doubleBuffer is really easy to use, thank you! ! !
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list