4/7/2023 0 Comments Snipping toolG.DrawImage(OriginalImage, 0, 0, rect, GraphicsUnit.Pixel) G.InterpolationMode = .HighQualityBicubic create bitmap with selected dimensionsīitmap _img = new Bitmap(selectWidth, selectHeight) create bitmap with original dimensionsīitmap OriginalImage = new Bitmap(pictureBox1.Image, pictureBox1.Width, pictureBox1.Height) Rectangle rect = new Rectangle(selectX, selectY, selectWidth, selectHeight) validate if something selected if (selectWidth > 0) Variable start in true or false that means when start the cropping action or ends respectively with help of event arg we can easily determine the rectangles width and height. They will save the initial mouse position after mouse down event set the Boolean The mouse move event had the variables selectX and selectY. PictureBox1.CreateGraphics().DrawRectangle(selectPen, selectX, same functionality when mouse is over if (e.Button = .Left) validate if there is image if (pictureBox1.Image = null) start control variable for draw rectangle SelectPen.DashStyle = DashStyle.DashDotDot validate when user right-click if (!start) Private void pictureBox1_MouseDown( object sender, MouseEventArgs e)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |