Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: add "AutoSaveAndRepaint" property to PictureBox control. #3000

Closed
ygc369 opened this issue Mar 21, 2020 · 2 comments
Closed

Proposal: add "AutoSaveAndRepaint" property to PictureBox control. #3000

ygc369 opened this issue Mar 21, 2020 · 2 comments

Comments

@ygc369
Copy link

@ygc369 ygc369 commented Mar 21, 2020

PictureBox current behavior:
If you paint something on the picturebox, and minimize the application that uses the picturebox, and then restore the application, you will find that what you have painted disappears.

This is a common problem that many people meet. So I hope that PictureBox control can have an "AutoSaveAndRepaint" property, if it is set as true, anything painted on the picturebox would be saved automatically and would not disappear when the picturebox is refreshed or repainted.

@weltkante

This comment has been minimized.

Copy link
Contributor

@weltkante weltkante commented Mar 21, 2020

How do you paint on the PictureBox, are you using the OnPaint event? This is an event from the Control base class and if you are using the Graphics object passed into it you are not actually painting on the PictureBox and could just use any other control.

The whole point of using a PictureBox is that you put an Image object in it (usually the Bitmap subclass), when you paint into the PictureBox you need to do Graphics.FromImage on that image and use this Graphics object for painting, then your changes will be persisted as desired. (You also get free scaling support if the image isn't the same size as the control.)

@RussKie

This comment has been minimized.

Copy link
Member

@RussKie RussKie commented Mar 23, 2020

Thank you fro the suggestion, but this isn't something we will add or accept.

As @weltkante explained, you need to modify an image that is displayed in a PictureBox instance rather than painting over the PictureBox itself.

@RussKie RussKie closed this Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.