国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

模仿QQ截圖片

2019-11-17 03:11:59
字體:
來源:轉載
供稿:網友
模仿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);        }    }}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 博爱县| 张家港市| 抚州市| 盐源县| 平江县| 克东县| 平安县| 漠河县| 喀喇沁旗| 安乡县| 太康县| 枣阳市| 东兰县| 上蔡县| 鹿泉市| 彰武县| 云南省| 夏邑县| 新民市| 财经| 文昌市| 无锡市| 麻栗坡县| 德庆县| 台南县| 江西省| 博罗县| 洪泽县| 朝阳县| 成安县| 锡林郭勒盟| 陕西省| 古丈县| 百色市| 大悟县| 巧家县| 秦皇岛市| 秦安县| 兴化市| 阳城县| 新竹市|