Windows Form Background
-
I need form with shaded background. One way, I can achieve it by making image of shaded color and set it as backgroundImage Second way, I can use System.Drawing.Drawing2D.LinearGradientBrush class with Form paint event My question is which one is good practice from the performance point of view ? Thanks in advance :)
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please
-
I need form with shaded background. One way, I can achieve it by making image of shaded color and set it as backgroundImage Second way, I can use System.Drawing.Drawing2D.LinearGradientBrush class with Form paint event My question is which one is good practice from the performance point of view ? Thanks in advance :)
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please
The difference will be trivial. If you're generating your background image from within your program, you should consider that GDI will probably have better algorithms than you for doing this. Also if your form is resized, you'll have to recalculate your background at every resize. If the form is only displayed once, you'll take a performance hit from going to an outside file, or paging in the resource you're using for the background. (bigger executable = larger loading time). But again, this are trivial performance differences.. Since you're displaying a form, I suspect that you want some user interaction. The user won't notice the difference.