C#如何在运行时通过鼠标拖动改变控件的大小

C#如何在运行时通过鼠标拖动改变控件的大小

ID:37708491

大小:117.50 KB

页数:13页

时间:2019-05-29

C#如何在运行时通过鼠标拖动改变控件的大小_第1页
C#如何在运行时通过鼠标拖动改变控件的大小_第2页
C#如何在运行时通过鼠标拖动改变控件的大小_第3页
C#如何在运行时通过鼠标拖动改变控件的大小_第4页
C#如何在运行时通过鼠标拖动改变控件的大小_第5页
资源描述:

《C#如何在运行时通过鼠标拖动改变控件的大小》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、C#如何在运行时通过鼠标拖动改变控件的大小作者:oayx

2、出处:博客园

3、2011/10/2622:12:23

4、阅读13次usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Data;usingSystem.Windows.Forms;usingSystem.Drawing;namespaceWindowsApplication2{   classResizeAction   {       boolIsMoving=false;       intctrlLastWidth

5、=0;       intctrlLastHeight=0;       intctrlWidth;       intctrlHeight;       intctrlLeft;       intctrlTop;       intcursorL;       intcursorT;       intctrlLastLeft;       intctrlLastTop;       intHtap;       intWtap;       boolctrlIsResizing=false;       System.Drawing.Rectanglectrl

6、Rectangle=newSystem.Drawing.Rectangle();       privateControlctrl;       privateFormfrm;       publicResizeAction(Controlc,Formfrm)       {           ctrl=c;           this.frm=frm;           this.Htap=this.frm.Height-this.frm.ClientRectangle.Height;           this.Wtap=this.frm.Width-

7、this.frm.ClientRectangle.Width;           ctrl.MouseDown+=newMouseEventHandler(MouseDown);           ctrl.MouseMove+=newMouseEventHandler(MouseMove);           ctrl.MouseUp+=newMouseEventHandler(MouseUp);       }       publicvoidMouseMove(objectsender,MouseEventArgse)       {          

8、 if(frm==null)               return;           if(e.Button==MouseButtons.Left)           {               if(this.IsMoving)               {                   if(ctrlLastLeft==0)                       ctrlLastLeft=ctrlLeft;                   if(ctrlLastTop==0)                       ctrlL

9、astTop=ctrlTop;                   intlocationX=(Cursor.Position.X-this.cursorL+this.frm.DesktopLocation.X+this.Wtap+this.ctrl.Location.X);                   intlocationY=(Cursor.Position.Y-this.cursorT+this.frm.DesktopLocation.Y+this.Htap+this.ctrl.Location.Y);                   if(loc

10、ationX

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。