您好,欢迎光临本网站![请登录][注册会员]  
文件名称: C#工具栏源代码
  所属分类: C#
  开发工具:
  文件大小: 158kb
  下载次数: 0
  上传时间: 2011-09-20
  提 供 者: ja3****
 详细说明: #region 漂浮状态 private ToolStripFloatWindow floatWindow; public ToolStripFloatWindow FloatWindow { get { return this.floatWindow; } set { floatWindow = value; if (FloatWindow != null) { floatWindow.LocationChanged += new EventHandler(floatWindow_LocationChanged); floatWindow.FormClosing += new FormClosingEventHandler(floatWindow_FormClosing); } } } public bool isFloating { get { return (floatWindow != null); } } private ToolStripPanel tsPanel; public ToolStripPanel ToolStripPanel { get { return this.tsPanel; } set { tsPanel = value; } } #endregion #region 漂浮实现 private void floatWindow_LocationChanged(object sender, EventArgs e) { //当floatwindws的位置移动到 toolstrippanel中时,将this放置到 toolstripPanel上 if (this.floatWindow == null) { return; } Point currentPt = new Point(floatWindow.Location.X, floatWindow.Location.Y); Point minpt = this.tsPanel.PointToScreen(tsPanel.Location); Point maxpt; if(this.tsPanel.Height <= 20){ maxpt = new Point(minpt.X + this.tsPanel.Width, minpt.Y + 20); }else{ maxpt = new Point(minpt.X + this.tsPanel.Width, minpt.Y + this.tsPanel.Height); } if ((currentPt.X > minpt.X) && (currentPt.X < maxpt.X) && (currentPt.Y > minpt.Y) && (currentPt.Y < maxpt.Y)) { this.floatWindow.Controls.Remove(this); this.tsPanel.SuspendLayout(); this.tsPanel.Controls.Add(this); this.Location = this.tsPanel.PointToClient(currentPt); this.tsPanel.ResumeLayout(); this.floatWindow.Dispose(); this.floatWindow = null; } } private void MyToolStrip_EndDrag(object sender, EventArgs e) { //判断移出时 if (this.tsPanel == null) { MessageBox.Show("请先设置ToolStripPanel属性"); return; } Point endPoint = Cursor.Position; int openX, openY; openX = endPoint.X; openY = endPoint.Y; Point clientPt = this.tsPanel.Parent.PointToClient(endPoint); if (clientPt.Y > tsPanel.Height) { ToolStripFloatWindow fw = new ToolStripFloatWindow(); this.tsPanel.Controls.Remove(this); fw.Controls.Add(this); this.Left = 0; this.Top = 0; this.FloatWindow = fw; Point newLoc = new Point(openX, openY); fw.Show(); fw.Location = newLoc; fw.SetBounds(newLoc.X, newLoc.Y, this.ClientSize.Width, this.ClientSize.Height); } } private void floatWindow_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; } private void MyToolStrip_SizeChanged(object sender, EventArgs e) { if (this.isFloating) { this.floatWindow.Width = this.ClientSize.Width; } } #endregion ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: c# 工具栏 曲沐阳
 输入关键字,在本站1000多万海量源码库中尽情搜索: