一个关于工具条可以移动和在四周停留的测试
2011-12-21 22:51
302 查看
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace qi { public partial class Form1 : Form { public Form1() { InitializeComponent(); } bool flag=false; bool ok = false; int fangshi = 0; Graphics mygf; Pen mypen = new Pen(Color.Red); Color mycl = new Color(); int width, height; private void Form1_MouseMove(object sender, MouseEventArgs e) { if (flag) { mygf.Clear(mycl); mygf.DrawRectangle(mypen, e.X - width, e.Y - 5, width, height); if (e.X < 20 && e.Y > 20 && e.Y < (this.Size.Height - 20)) { mygf.Clear(mycl); mygf.DrawRectangle(mypen, 0, 0, 20, this.Size.Height); fangshi = 1; } else if (e.Y < 20 && e.X < (this.Size.Width - 20)) { mygf.Clear(mycl); mygf.DrawRectangle(mypen, 0, 0, this.Size.Width, 20); fangshi = 2; } else if (e.Y < (this.Size.Height - 20) && e.X > (this.Size.Width - 40)) { mygf.Clear(mycl); mygf.DrawRectangle(mypen, this.Size.Width - 35, 0, 30, this.Size.Height); fangshi = 3; } else if (e.Y > (this.Size.Height - 55)) { mygf.Clear(mycl); mygf.DrawRectangle(mypen, 0, (this.Size.Height - 55), this.Size.Width, 20); fangshi = 4; } else fangshi = 0; } } private void toolStrip1_MouseDown(object sender, MouseEventArgs e) { toolStrip1.Visible = false; flag = true; } private void Form1_MouseUp(object sender, MouseEventArgs e) { if (flag) { toolStrip1.Location = new Point(e.X - width, e.Y - 5); switch (fangshi) { case 0: toolStrip1.Dock = DockStyle.None; break; case 1: toolStrip1.Dock = DockStyle.Left; break; case 2: toolStrip1.Dock = DockStyle.Top; break; case 3: toolStrip1.Dock = DockStyle.Right; break; case 4: toolStrip1.Dock = DockStyle.Bottom; break; } } toolStrip1.Visible = true; mygf.Clear(mycl); flag = false; fangshi = 0; } private void Form1_Load(object sender, EventArgs e) { mycl = this.BackColor; mygf = this.CreateGraphics(); width = toolStrip1.Size.Width; height = toolStrip1.Size.Height; } } }
相关文章推荐
- 关于一个收藏功能 在我本地可以但在测试那里不可以的故事
- 关于从四个方向往一个地方移动后碰撞往后小退的代码
- 关于异步事件的一个测试及其分析结果
- Oracle 10g中一个关于绑定变量和非绑定变量的测试对比
- 软件测试面试 (二)如何测试网页的登录页面 如何测试一个杯子 关于测试方法的
- 关于搭建一个高性能网站的服务器的架设思路以及nginx测试的并发
- 打包测试 之 制作一个可以上传到 FIR.im 的 ipa 文件 - Ad-Hoc篇
- 测试管理_关于面试中最后的一个问题
- 一个很好的blog地址,关于手机测试(appium\ Robotium等 )
- 已知一个几乎有序的数组,几乎有序是指,如果把数组排好顺序的话,每个元素移动的距离可以不超过k,并且k相对于数组来说比较小。请选择一个合适的排序算法针对这个数据进行排序。 给定一个int数组A,同时给定
- 介绍一个在线的Linux,没有安装Linux或者虚拟机不喜欢用的童鞋可以简单的用这个jslinux测试各种命令
- 【Android】一个浏览图片的Android库的实现,可以移动、缩放图片以及滑动切换
- 一个移动动画,可以用来做扩展
- 一个可以做测试用的免费JSP空间
- 关于移动设备上GIS系统开发的一个问题(EVC+MapXMobile)
- 关于移动终端之WiFi测试点的总结
- 关于PreparedStatement接口的一个测试
- 在51上看的一个关于游戏的测试流程图跟最近学的测试相似
- 一个关于测试的blog
- 一个关于设计模式的网站。喜欢的大家可以上去看看