F1MBF


    Sometimes it happens that a man's circle of horizon
    becomes smaller and smaller, and as the radius
    approaches zero it concentrates on one point.
    And then that becomes his point of view.

    Hilbert-Courant (1984) by Constance Reid, p. 174

Draw in SharpDevelop (Console Application)
Raptor Style (oh no, not Gangnam style)
RClick on Solution+>foo->References
  add references: System.Drawing, System.Windows.Forms
------------------------------------------------------

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

  namespace foo {
    class MainForm : Form {
      Pen mPen;
      public MainForm() {
        this.Size = new Size(420, 280);
        mPen = new Pen( Color.Red);
      }

      protected override void OnPaint(PaintEventArgs e) {
        Graphics g = e.Graphics;
          g.DrawLine( mPen, 10, 10, 400, 200);
      }

      protected override void OnClick( EventArgs e) {
        Graphics g = this.CreateGraphics();
          SolidBrush yBrush = new SolidBrush(Color.Yellow);
          Rectangle rect = new Rectangle(10, 10, 200, 200);
          g.FillRectangle(yBrush, rect);
      }
    }

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

Note: not filled on right, bottom
---------------------------------

  protected override void OnClick( EventArgs e)
  {
    Graphics g = this.CreateGraphics();

    g.DrawLine( mPen, 400, 10, 10, 200);
    Rectangle vRect = new Rectangle( 20, 20, 100, 100);
    SolidBrush vBrush = new SolidBrush( Color.Yellow);
    // Do not draw, fill immediately
    g.DrawRectangle( mPen, vRect);
    g.FillRectangle( vBrush, vRect);
  }

Draw in SharpDevelop (WinForm Application)
------------------------------------------

Program.cs

  using System;
  using System.Windows.Forms;

  namespace draw
  {
    internal sealed class Program
    {
      [STAThread]
      private static void Main(string[] args)
      {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new MainForm());
      }
    }
  }

MainForm.cs

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

  namespace draw
  {
    public partial class MainForm : Form
    {
      Pen mPen;

      public MainForm()
      {
        InitializeComponent();
        mPen = new Pen( Color.Red);
      }

      void PictureBox1Paint(object sender, PaintEventArgs e)
      {
        Graphics g = e.Graphics;
        g.DrawLine( mPen, 10, 10, 400, 200);
        g.DrawRectangle( mPen, new Rectangle( 20, 20, 100, 100));
      }
    }
  }

MainFormDesigner.cs

  namespace draw
  {
    partial class MainForm
    {
      private System.ComponentModel.IContainer components = null;
      private System.Windows.Forms.PictureBox pictureBox1;

      protected override void Dispose(bool disposing)
      {
        if (disposing) {
          if (components != null) {
            components.Dispose();
          }
        }
        base.Dispose(disposing);
      }

      private void InitializeComponent()
      {
        this.pictureBox1 = new System.Windows.Forms.PictureBox();
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).
          BeginInit();
        this.SuspendLayout();

        this.pictureBox1.Location = new System.Drawing.Point(14, 14);
        this.pictureBox1.Name = "pictureBox1";
        this.pictureBox1.Size = new System.Drawing.Size(502, 485);
        this.pictureBox1.TabIndex = 0;
        this.pictureBox1.TabStop = false;
        this.pictureBox1.Paint += new
          System.Windows.Forms.PaintEventHandler(this.PictureBox1Paint);
        //
        // MainForm
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(652, 511);
        this.Controls.Add(this.pictureBox1);
        this.Name = "MainForm";
        this.Text = "draw";
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).
          EndInit();
        this.ResumeLayout(false);
      }
    }
  }

