Gui flackert jetzt beim neu zeichnen nicht mehr

This commit is contained in:
2014-05-08 01:00:42 +02:00
parent 238ea02bb9
commit b0d3e59a75
2 changed files with 3 additions and 6 deletions

View File

@@ -74,7 +74,6 @@ namespace WorldOfPeacecraft
ChatPanel.Location = new Point (MapPanel.Width, 0);
ChatPanel.Size = new Size (ChatWidth, MapPanel.Height);
this.ResumeLayout();
this.PerformLayout();
ChatPanel.UpdateData ();
this.Refresh();
}));

View File

@@ -25,8 +25,8 @@ namespace WorldOfPeacecraft
public MapPanel (IBackend backend)
{
SetStyle (ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
Backend = backend;
this.Paint += DoPaint;
this.PreviewKeyDown += board_KeyPress;
BowAndArrow = Image.FromFile (ImagesFolder + "bow-and-arrow.png", false);
Dragon1 = Image.FromFile (ImagesFolder + "dragon1.png");
@@ -76,15 +76,13 @@ namespace WorldOfPeacecraft
Backend.MoveTo (targetX, targetY);
}
public void DoPaint (object source, PaintEventArgs args)
protected override void OnPaint (PaintEventArgs e)
{
BufferedGraphics buffer = BufferedGraphicsManager.Current.Allocate (this.CreateGraphics (), this.DisplayRectangle);
Graphics g = buffer.Graphics;
Graphics g = e.Graphics;
lock (Backend) {
PaintMap (g);
PaintEntities (g);
}
buffer.Render();
}
public void PaintMap (Graphics g)