SystemInformation.PrimaryMonitor : SystemInformation « System.Windows.Forms « C# / C Sharp by API






SystemInformation.PrimaryMonitor

  
using System;
using System.Drawing;
using System.Windows.Forms;
   
class ScribbleWithBitmap: Form
{
     bool     bTracking;
     Point    ptLast;
     Bitmap   bitmap;
     Graphics grfxBm;
   
     public static void Main()
     {
          Application.Run(new ScribbleWithBitmap());
     }
     public ScribbleWithBitmap()
     {
          Text = "Scribble with Bitmap";
          Size size = SystemInformation.PrimaryMonitorMaximizedWindowSize;
          bitmap = new Bitmap(size.Width, size.Height);
   
          grfxBm = Graphics.FromImage(bitmap);
          grfxBm.Clear(BackColor);
     }
     protected override void OnMouseDown(MouseEventArgs mea)
     {
          if (mea.Button != MouseButtons.Left)
               return;
   
          ptLast = new Point(mea.X, mea.Y);
          bTracking = true;
     }
     protected override void OnMouseMove(MouseEventArgs mea)
     {
          if (!bTracking)
               return;
   
          Point ptNew = new Point(mea.X, mea.Y);
          
          Pen pen = new Pen(ForeColor);
          Graphics grfx = CreateGraphics();
          grfx.DrawLine(pen, ptLast, ptNew);
          grfx.Dispose();
   
          grfxBm.DrawLine(pen, ptLast, ptNew);
   
          ptLast = ptNew;
     }
     protected override void OnMouseUp(MouseEventArgs mea)
     {
          bTracking = false;
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          Graphics grfx = pea.Graphics;
          grfx.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height);
     }
}

   
    
  








Related examples in the same category

1.SystemInformation.ArrangeDirection
2.SystemInformation.ArrangeStartingPosition
3.SystemInformation.ArrangeStartingPosition(all System Information
4.SystemInformation.BootMode
5.SystemInformation.Border3DSize
6.SystemInformation.BorderSize
7.SystemInformation.CaptionButtonSize
8.SystemInformation.CaptionHeight
9.SystemInformation.ComputerName
10.SystemInformation.CursorSize
11.SystemInformation.DbcsEnabled
12.SystemInformation.DoubleClickSize
13.SystemInformation.DoubleClickTime
14.SystemInformation.FrameBorderSize
15.SystemInformation.MouseButtons
16.SystemInformation.MouseButtonsSwapped
17.SystemInformation.MousePresent
18.SystemInformation.MouseWheelPresent
19.SystemInformation.MouseWheelScrollLines
20.SystemInformation.NativeMouseWheelSupport
21.SystemInformation.PrimaryMonitorMaximizedWindowSize