Gui flackert jetzt beim neu zeichnen nicht mehr
This commit is contained in:
@@ -74,7 +74,6 @@ namespace WorldOfPeacecraft
|
|||||||
ChatPanel.Location = new Point (MapPanel.Width, 0);
|
ChatPanel.Location = new Point (MapPanel.Width, 0);
|
||||||
ChatPanel.Size = new Size (ChatWidth, MapPanel.Height);
|
ChatPanel.Size = new Size (ChatWidth, MapPanel.Height);
|
||||||
this.ResumeLayout();
|
this.ResumeLayout();
|
||||||
this.PerformLayout();
|
|
||||||
ChatPanel.UpdateData ();
|
ChatPanel.UpdateData ();
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ namespace WorldOfPeacecraft
|
|||||||
|
|
||||||
public MapPanel (IBackend backend)
|
public MapPanel (IBackend backend)
|
||||||
{
|
{
|
||||||
|
SetStyle (ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
|
||||||
Backend = backend;
|
Backend = backend;
|
||||||
this.Paint += DoPaint;
|
|
||||||
this.PreviewKeyDown += board_KeyPress;
|
this.PreviewKeyDown += board_KeyPress;
|
||||||
BowAndArrow = Image.FromFile (ImagesFolder + "bow-and-arrow.png", false);
|
BowAndArrow = Image.FromFile (ImagesFolder + "bow-and-arrow.png", false);
|
||||||
Dragon1 = Image.FromFile (ImagesFolder + "dragon1.png");
|
Dragon1 = Image.FromFile (ImagesFolder + "dragon1.png");
|
||||||
@@ -76,15 +76,13 @@ namespace WorldOfPeacecraft
|
|||||||
Backend.MoveTo (targetX, targetY);
|
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 = e.Graphics;
|
||||||
Graphics g = buffer.Graphics;
|
|
||||||
lock (Backend) {
|
lock (Backend) {
|
||||||
PaintMap (g);
|
PaintMap (g);
|
||||||
PaintEntities (g);
|
PaintEntities (g);
|
||||||
}
|
}
|
||||||
buffer.Render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PaintMap (Graphics g)
|
public void PaintMap (Graphics g)
|
||||||
|
|||||||
Reference in New Issue
Block a user