.net - How do i draw my "user control UI" faster and more efficient -


In fact, I have a user control is made that the interface windows vista "glass window" and seven. My pattern was URL: extremestudio.ro/blog/?p=99

"using Photoshop" and C # every layer and draw with .Net drawing classes, I finally draws it I am In the first step, I am creating a bitmap square and then each layer will be dragged on it using a graphic path and brush.

Here's the control: (You must first add "reflect.png" to add the file to your project resources and then add a class to create the project ...) This control form namespace Receives from the panel in


  Secure Override Zero OnCreateControl () {Draw (); Backgroundmaylayout = system Windows .form. Image layout. Stretch; Parent.Move + = new event handler (Pentrumov); Base.OnCreateControl (); } Zero Parent_Move (Object Sender, EventArgs e) {Draw (); } Public void draw () (if (width & lt; 20 || height & lt; 20) {return;} Bitmap b = new Bitmap (width, height); Graphics g = Grafikskfremijhejh (B); Grafikspat GP = new Grafikspath (); Rakikgrediantbrs time; Gr.SmoothingMode = SmoothingMode.HighSpeed; // IT (inter I = 0; i & lt; 10; i ++) {gp = DrawRoundRect (i, i, width - i * 1 - 2, height - i * 2 - 1, 7) for shadow (Black gloss) draw; Br = new LinearGradientBrush (bouncing, Rngkformaarbibi (i * 3, color. Black), Rngkformaar GR (i * 3, Color. Black), RainierGradientMode. Vertical; Gr.Dropath (new pen (BR, 4), GP); br.Dispose ();} // Fill white 50GP = DrawRect (9, 9) width - 1 9, height - 1 9, 7); Br = new LinearGradientBrush (bouncing, Rngkformaarbibi (30 colors. White) color. Fomaarbibi (30 colors. White), Raniargriadayntmodkwartikl); gr. Philpath (BR, GP);  

This was part of the drawing code. I set the bitmap created in the finnaly panel background.

Ap- pears that (can not remember) Also I use the "overriding method," onPaint () ... but the program crashed because paint event increase continuously.

OK,

My problem is less efficiency of this control while carrying and resizing parent form. Because it works, due to the call of control and the "Draw" method, there is a lot to call on the method, this application will be slow and more important, it is very CPU hungry.

I want you to know how to attract the user interface of this control

1-Using dot net 2.0

2-efficient

is a method of painting the UI directly ... ... (I do not mean WPF)

if there is no way , Then I will remove the reflected part of the code that uses high CPU.

Thank you.

Thanks everyone for the attention.

I remove all the code which makes the program slow. I simplify it to simple limits and a shadow on it.

double buffer property (use this true Set on.)
Drawing will work ten times faster!


Comments