Use Shortcut or DrawString in UserControl

I am writing my own control that will contain a panel with text, images and other media. What is the best way to render text and images. The control can contain long texts and many images.
Should I add text as labels and images as a PictureBox, or use the DrawString and DrawImage methods to render text and images?
What's the best way to do this?

+1


source to share


2 answers


If you use labels, you get free labeling free.

If you are using DrawString, then it will probably be (slightly) faster, but it is much more difficult if you have to deal with things like changing text.



The OnPaint handler is always tricky to write, and invalidating the client area is hard to do efficiently.

Why not let all methods handle it all?

+2


source


I would use DrawString and DrawImage, you have fewer resources to worry about but with added complexity.

I don't think it is bad at drawing your own lines and images when you step into it.



this is a nice introduction:

http://www.bobpowell.net/

+1


source







All Articles