private void OnPaint(object sender, PaintEventArgs e)
{
map = currmap.GetImage(hScrollBar.Value >> 3, vScrollBar.Value >> 3,
(int)((e.ClipRectangle.Width / Zoom) + 8) >> 3, (int)((e.ClipRectangle.Height / Zoom) + 8) >> 3,
showStaticsToolStripMenuItem1.Checked);
ZoomMap(ref map);
e.Graphics.DrawImageUnscaledAndClipped(map, e.ClipRectangle);
if (showCenterCrossToolStripMenuItem1.Checked)
{
Brush brush = new SolidBrush(Color.FromArgb(180, Color.White));
Pen pen = new Pen(brush);
int x = Round((int)(pictureBox.Width / 2));
int y = Round((int)(pictureBox.Height / 2));
e.Graphics.DrawLine(pen, x - 4, y, x + 4, y);
e.Graphics.DrawLine(pen, x, y - 4, x, y + 4);
pen.Dispose();
brush.Dispose();
}
if (showClientCrossToolStripMenuItem.Checked)
{
if (Client.Running)
{
if ((ClientX > hScrollBar.Value) &&
(ClientX < hScrollBar.Value + e.ClipRectangle.Width / Zoom) &&
(ClientY > vScrollBar.Value) &&
(ClientY < vScrollBar.Value + e.ClipRectangle.Height / Zoom) &&
(ClientMap == currmapint))
{
Brush brush = new SolidBrush(Color.FromArgb(180, Color.Yellow));
Pen pen = new Pen(brush);
int x = (int)((ClientX - Round(hScrollBar.Value)) * Zoom);
int y = (int)((ClientY - Round(vScrollBar.Value)) * Zoom);
e.Graphics.DrawLine(pen, x - 4, y, x + 4, y);
e.Graphics.DrawLine(pen, x, y - 4, x, y + 4);
e.Graphics.DrawEllipse(pen, x - 2, y - 2, 2 * 2, 2 * 2);
pen.Dispose();
brush.Dispose();
}
}
}
if (OverlayObjectTree.Nodes.Count > 0)
{
if (showMarkersToolStripMenuItem.Checked)
{
foreach (TreeNode obj in OverlayObjectTree.Nodes[currmapint].Nodes)
{
OverlayObject o = (OverlayObject)obj.Tag;
if (o.isVisible(e.ClipRectangle, currmapint))
{
o.Draw(e.Graphics);
}
}
}
}
}