using System;
using System.Drawing;
using System.Windows.Forms;

public class MainForm : Form
{
	protected Image img = null;

	public MainForm()
	{
		SetStyle(ControlStyles.ResizeRedraw, true);
		img = Image.FromFile("coins.bmp");
		Text = "Растровое изображение";
	} 

	protected override void OnPaint(PaintEventArgs e)
	{
		e.Graphics.DrawImage(img, 0, 0, ClientRectangle.Width, ClientRectangle.Height);
		base.OnPaint(e);
	}

	protected override void OnMouseUp(MouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right)
		{
			MessageBox.Show(String.Format("Width = {0}, Height = {1}\n" +
				"Physical width = {2}, Physical height = {3}\n" +
				"Horizontal resolution (DPI) = {4}, Vertical resolution (DPI) = {5}\n" +
				"",
				img.Width, img.Height,
				img.PhysicalDimension.Width, img.PhysicalDimension.Height,
				img.HorizontalResolution, img.VerticalResolution), "Информация");
		} else if (e.Button == MouseButtons.Left) {
			using(Graphics g = Graphics.FromImage(img))
			using (Pen p = new Pen(Color.Black, 1))
			{
				float x0 = img.Width * e.X / (float)ClientRectangle.Width;
				float y0 = img.Height * e.Y / (float)ClientRectangle.Height;
				g.DrawEllipse(p, x0 - 3, y0 - 3, 7, 7);
			}
			Invalidate();
		}
		base.OnMouseUp(e);
	}

	public static void Main(string[] args)
	{
		Application.Run(new MainForm());
	}
}