日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

模仿QQ截图片

發布時間:2023/12/13 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 模仿QQ截图片 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
兩個picturebox,一個放圖片完整代碼如下using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.OleDb; using System.Xml; namespace Test {public partial class Form1 : Form{private bool MouseIsDown = false;private int _x, _y;private Rectangle MouseRect = Rectangle.Empty;public Form1(){InitializeComponent();}private void ResizeToRectangle(Point p){DrawRectangle();MouseRect.Width = p.X - MouseRect.Left;MouseRect.Height = p.Y - MouseRect.Top;DrawRectangle();}private void DrawRectangle(){Rectangle rect = this.RectangleToScreen(MouseRect);ControlPaint.DrawReversibleFrame(rect, Color.White, FrameStyle.Dashed);}private void DrawStart(Point StartPoint){barkPictureBox.Capture = true;Cursor.Clip = this.RectangleToScreen(new Rectangle(0, 0, ClientSize.Width, ClientSize.Height));MouseRect = new Rectangle(StartPoint.X, StartPoint.Y, 0, 0);}private void button1_Click(object sender, EventArgs e){}void barkPictureBox_MouseUp(object sender, MouseEventArgs e){barkPictureBox.Capture = false;Cursor.Clip = Rectangle.Empty;MouseIsDown = false;DrawRectangle();if (MouseRect.X == 0 || MouseRect.Y == 0 || MouseRect.Width == 0 || MouseRect.Height == 0) //如果區域有一個是0就返回 {}else{///代碼 }MouseRect = Rectangle.Empty;int sx = _x < e.X ? _x : e.X;int sy = _y < e.Y ? _y : e.Y;int w = Math.Abs(_x - e.X);int h = Math.Abs(_y - e.Y);Graphics g = Graphics.FromHwnd(pictureBox2.Handle);g.Clear(pictureBox2.BackColor);g.DrawImage(barkPictureBox.Image, new Rectangle(0, 0, w, h), sx, sy, w, h, GraphicsUnit.Pixel); }void barkPictureBox_MouseMove(object sender, MouseEventArgs e){if (MouseIsDown) ResizeToRectangle(new Point(e.X + barkPictureBox.Location.X, e.Y + barkPictureBox.Location.Y));}void barkPictureBox_MouseDown(object sender, MouseEventArgs e){_x = e.X;_y = e.Y;MouseIsDown = true;DrawStart(new Point(e.X + barkPictureBox.Location.X, e.Y + barkPictureBox.Location.Y));}private void Form1_Load(object sender, EventArgs e){barkPictureBox.MouseDown += new MouseEventHandler(barkPictureBox_MouseDown);barkPictureBox.MouseMove += new MouseEventHandler(barkPictureBox_MouseMove);barkPictureBox.MouseUp += new MouseEventHandler(barkPictureBox_MouseUp);}} }

?

轉載于:https://www.cnblogs.com/gc2013/p/3696743.html

總結

以上是生活随笔為你收集整理的模仿QQ截图片的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。