private void ExtractMapJpg(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; string path = FiddlerControls.Options.OutputPath; string name = String.Format("{0}.jpg", Options.MapNames[currmapint]); string FileName = Path.Combine(path, name); Bitmap extract = currmap.GetImage(0, 0, (currmap.Width >> 3), (currmap.Height >> 3), showStaticsToolStripMenuItem1.Checked); if (showMarkersToolStripMenuItem.Checked) { Graphics g = Graphics.FromImage(extract); foreach (TreeNode obj in OverlayObjectTree.Nodes[currmapint].Nodes) { OverlayObject o = (OverlayObject)obj.Tag; if (o.Visible) { o.Draw(g); } } g.Save(); } extract.Save(FileName, ImageFormat.Jpeg); Cursor.Current = Cursors.Default; MessageBox.Show(String.Format("Map saved to {0}", FileName), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); }
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); } } } } }