Quantcast
Channel:
Viewing all articles
Browse latest Browse all 43971

Forum Post: RE: Using MouseMove in a PictureBox to enter i.e a signature on a touch screen.

$
0
0
Seems I've answered the question myself. Should anyone need this feature, here is a piece of code using Windows Forms. 1st Create a pictureBox 2nd set the mouse properties Up, Down Move      $set ilusing "System.Drawing".      $set ilusing "System.Drawing.Graphics".      $set ilusing "System.IO.Stream". working-storage       01 Pen              type Pen.       01 bmp              type Bitmap.       01 g                type Graphics.       01 _Previous        type Point.       01 mouseval         pic 9.        88 mousedown       value 1 false 0. Methods:       method-id pictureBox1_Paint final private.       procedure division using by value sender as object e as type System.Windows.Forms.PaintEventArgs.           set Pen to new Pen(type Color::Black, 3)       end method.       method-id pictureBox1_MouseMove final private.       procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.           if mousedown               if pictureBox1::Image = Null                   set bmp to new Bitmap(PictureBox1::Width, PictureBox1::Height)                   set g to type Graphics::FromImage(bmp)                   invoke g::Clear(type Color::White)                   set pictureBox1::Image to bmp               else                   invoke g::DrawLine(Pen, _Previous::X, _Previous::Y, e::X, e::Y)               end-if               invoke pictureBox1::Invalidate()               set _Previous::X to e::X               set _Previous::Y to e::Y           end-if       end method.       method-id pictureBox1_MouseDown final private.       procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.           set _Previous to new Point(e::X, e::Y)           set mousedown to true       end method.       method-id pictureBox1_MouseUp final private.       procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.           set mousedown to false           set _Previous to Null       end method.       method-id button2_Click final private.       procedure division using by value sender as object e as type System.EventArgs.                 invoke bmp::Save("Signature.bmp", type System.Drawing.Imaging.ImageFormat::Bmp)           set pictureBox1::Image to Null       end method.

Viewing all articles
Browse latest Browse all 43971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>