Click here to Skip to main content
15,886,066 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I use a pictureBox and Bitmap,drop on form.
First I paint on my bitmap,and using picture's attribute :image, direct render what I have painted. Because my pen need Alpha value,so I use GDI+ to solve it. As the occurrence of using GDI+ ,I found the speed of my brush so slowly. During test ,I know the reason that each what I have painted with alpha needs to calculate,and I alse found I lost the chance to enter into mousemove event which may leads I lost dot. I don't know how to improve it,if you have some idea,please let me know soon.
Posted
Comments
OriginalGriff 21-May-12 3:05am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
I know that English isn't your first language, but we need a better description of your problem: perhaps some relevant code fragments?
Use the "Improve question" widget to edit your question and provide better information.
Sergey Alexandrovich Kryukov 21-May-12 15:01pm    
You are right, but at least one source of compromised performance is clear -- please see my answer.
--SA

1 solution

You can improve the speed and also simplify your development by not using the class PictireBox. This class is helpful in some simplest situations, when you need to show some static picture, or maybe change it sometimes. When you try to do something dynamic, interactive, animated, etc, this class provides no help but presents some additional hassles, eats some extra resources, compromises performance giving absolutely nothing in return. You just use some absolutely redundant additional layer between data and image rendering. Just remove it. I'll explain what to do instead.

Please see my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^],
Append a picture within picturebox[^].

Please see my more general answers on GDI+ rendering:
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^].

Good luck,
—SA
 
Share this answer
 
v4
Comments
Maciej Los 21-May-12 15:03pm    
Very good answer, my 5!
Sergey Alexandrovich Kryukov 21-May-12 15:04pm    
Thank you.
--SA
HuCongquan 21-May-12 22:07pm    
Thanks for you help SA,I will remove pictureBox in my code,try to use control's invalidate to invoke control's paint event.And I will improve my ability to speak English .
Sergey Alexandrovich Kryukov 28-May-12 17:27pm    
Very good; my pleasure.
If you agree with my answer, please accept if formally (green button) -- thanks.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900