Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="frmMystify"/> class.
 /// </summary>
 public frmMystify()
 {
     InitializeComponent();
     Usefull.speed = ONE_SECOND_IN_MILISECONDS / trcSpeed.Value;
     //Create Draw Timer. Call draw function with blank object
     drawTimer = new MyTimer(ONE_SECOND_IN_MILISECONDS / FRAMES_PER_SECOND, draw, new object());
     //Create bitmap sized to fit the pane
     img = new Bitmap(pnlPane.Width, pnlPane.Height);
     //Create graphic from bitmap
     g = Graphics.FromImage(img);
     //Easy way to give access to pane from all classes. allowing resizing.
     Usefull.drawPanel = pnlPane;
     paneWidthPercent  = (float)pnlPane.Width / this.Width;
     paneHeightPercent = (float)pnlPane.Height / this.Height;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the down event of the pane_mouse control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
 private void pane_mouse_down(object sender, MouseEventArgs e)
 {
     //Allow new lines if not paused
     if (!paused)
     {
         //Create new Myst
         MystLine newMyst = new MystLine(pnlPane, e.Location);
         //Create new Timer for line (calls update method of new Myst)
         MyTimer newTimer = new MyTimer(ONE_SECOND_IN_MILISECONDS / trcSpeed.Value, newMyst.update, this);
         timers.Add(newTimer);
         //Add when mystShapes if free.
         lock (lockMystShapes)
         {
             mystShapes.Add(newMyst);
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="frmMystify"/> class.
 /// </summary>
 public frmMystify()
 {
     InitializeComponent();
     Usefull.speed = ONE_SECOND_IN_MILISECONDS / trcSpeed.Value;
     //Create Draw Timer. Call draw function with blank object
     drawTimer = new MyTimer(ONE_SECOND_IN_MILISECONDS / FRAMES_PER_SECOND, draw, new object());
     //Create bitmap sized to fit the pane
     img = new Bitmap(pnlPane.Width,pnlPane.Height);
     //Create graphic from bitmap
     g = Graphics.FromImage(img);
     //Easy way to give access to pane from all classes. allowing resizing.
     Usefull.drawPanel = pnlPane;
     paneWidthPercent = (float)pnlPane.Width / this.Width;
     paneHeightPercent = (float)pnlPane.Height / this.Height;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Handles the down event of the pane_mouse control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
 private void pane_mouse_down(object sender, MouseEventArgs e)
 {
     //Allow new lines if not paused
     if (!paused)
     {
         //Create new Myst
         MystLine newMyst = new MystLine(pnlPane, e.Location);
         //Create new Timer for line (calls update method of new Myst)
         MyTimer newTimer = new MyTimer(ONE_SECOND_IN_MILISECONDS / trcSpeed.Value, newMyst.update, this);
         timers.Add(newTimer);
         //Add when mystShapes if free.
         lock (lockMystShapes)
         {
             mystShapes.Add(newMyst);
         }
     }
 }