.net - C# Drawing - best solution -


Today I'm trying to solve the problem with a blinking panel when I want to draw it on.

  • That's why I used Picture Box, Tried to draw on the double on the micpalen at Doubleford, but I found that the best solution, when I read, I live every time Claire () can not be used, even after the non-double buffer panel, the flick disappeared.

    I also read, that after drawing, I should release the graphics. So I use everywhere everywhere using Graphics G = panel.crafficraphics ()

    So my question , is it a great idea to create graphics for bitmap, when I do something? Because before I created bitmaps, and graphics (only for this bitmap, for all the components), so every time this graphics was available for this bitmap

    here's my code:

      public zero new size () {Size size = collector .getLetterSize (selected name); Size Drawing Size = New Size (Size Wide * (Pixel Size [Pixel Size] + 1), Size. High * (Pixel Sizes Array [Pixel Size + 1)); Bitmaprod = new bitmap (drawings width, drawing size. Height); Int width = (this.MinimumSize.Width - panelDraw.MinimumSize.Width) + Drawing size. With + 10; Int height = (this.MinimumSize.Height - panelDraw.MinimumSize.Height) + Drawing size. Hi + 10; this. Size = new size (width (gt; width); width: minimum width? Width: minimum size. Wide, (height> this minimum size height): this minimum size. Zero Dropon = New Point ((Panel Draw Size. With - Bitmap Draw Width) / 2 - 1, (Panel Draw Size. Height - Bitmap Draw High.) / 2 - 1); Using (Graphics G = Screen Draw Craig Graphics ()) {g.Clear (panelDraw.BackColor); } RedrawDrawingLetter (); } Public Zero RedrawDrawingLetter () {bool [] [] grid = collector.getArray (selected name); (Graphics Graphic Draw = Graphics. Widgesize (Bitmapradra)) using {graphicDraw.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; GraphicDraw.Clear (panelDraw.BackColor); Int pxSize = pixelSizeArray [pixelSize]; For (int y = 0; y & lt; grid.Length; y ++) {for (int x = 0; x & lt; grid [y]. Lamps; x ++) {graphicDraw.FillRectangle (( Grid [y] [x] Brush Black: Brush White), X * (Pxs + 1), Y * (Pxs + 1), Pxsys, Pxsize); }}} Radra Drawing Panel (); } Private Zero Red DrawingPanel (use) (Graphics G = Panel DrawCreative Graphics ()) {If (Bitmap Draw! = Null) Drawings (bitmap draw, zero drop); }} Private Zero Panel Drabant (Object Sender, Paint Event ARG E) {redrawDrawingPanel (); } No one can explain to me how to attract the best way in C # so maybe my code is not good, but this is the reason why I want to do it correctly. I am  

    New Sized Drawing is called by itself, when users click on the + or - button. I have a Bull double dimension array if the pixel is on or off. This is a program for preparing letters for microchips and LED displays (often 8 pixel height letters).

    I have written a method that checks that the mouse moves from one "pixel" to another, so I do not repeat this after each call mouse move event, because "pixel" is 10x10 px Can be up to 30x30 px.

      Private Zero Panel Drabsant (Object Sender, Paint Event ARG E) {redrawDrawingPanel (); }   

    This is fundamentally incorrect Paint Event Egfix passes so that you can attract whatever you want to paint. When you turn on double-buffering, E. Referring to graphics bitmap, it is started with backallore. Then you continue drawing by using the Other graphics object derived from CreateGraphics () it drages it directly to the screen.

    You see the flicker effect very for the second part of the pronunciation that shows what other graphics references. Then your PanelDownView () method draws a double-buffer bitmap return and winform. There is nothing in it, so it immediately erases what you attracted.

    Modify the red drawing panel () method and argue it to type graphics. Call in e Pass the graphics and use only that graphics object, remove all calls on CreateGraphics ()

  • Comments