



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Drawing.Drawing2D;namespace TestFrm public partial class TestFrm : Form /定义鼠标消息常量 private const int WM_NCHITTEST = 0X0084; private const int HT_LEFT = 10; private const int HT_RIGHT = 11; private const int HT_TOP = 12; private const int HT_TOPLEFT = 13; private const int HT_TOPRIGHT = 14; private const int HT_BOTTOM = 15; private const int HT_BOTTOMLEFT = 16; private const int HT_BOTTOMRIGHT = 17; private const int HT_CAPTION = 2; /处理Windows消息 protected override void WndProc(ref Message Msg) if (Msg.Msg = WM_NCHITTEST) /获取鼠标位置 int nPosX = (Msg.LParam.ToInt32() & 65535); int nPosY = (Msg.LParam.ToInt32() 16); /右下角 if (nPosX = this.Right - 6 & nPosY = this.Bottom - 6) Msg.Result = new IntPtr(HT_BOTTOMRIGHT); return; /左上角 else if (nPosX = this.Left + 6 & nPosY = this.Top + 6) Msg.Result = new IntPtr(HT_TOPLEFT); return; /左下角 else if (nPosX = this.Bottom - 6) Msg.Result = new IntPtr(HT_BOTTOMLEFT); return; /右上角 else if (nPosX = this.Right - 6 & nPosY = this.Right - 2) Msg.Result = new IntPtr(HT_RIGHT); return; else if (nPosY = this.Bottom - 2) Msg.Result = new IntPtr(HT_BOTTOM); return; else if (nPosX = this.Left + 2) Msg.Result = new IntPtr(HT_LEFT); return; else if (nPosY = this.Top + 2) Msg.Result = new IntPtr(HT_TOP); return; else Msg.Result = new IntPtr(HT_CAPTION); return; base.WndProc(ref Msg); public TestFrm() InitializeComponent(); public void SetWindowRegion() System.Drawing.Drawing2D.GraphicsPath FormPath; FormPath = new System.Drawing.Drawing2D.GraphicsPath(); Rectangle rect = new Rectangle(0, 0, this.Width, this.Height); FormPath = GetRoundedRectPath(rect, 10); this.Region = new Region(FormPath); private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius) int diameter = radius; Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter); GraphicsPath path = new GraphicsPath(); / 左上角 path.AddArc(arcRect, 180, 90); / 右上角 arcRect.X = rect.Right - diameter; path.AddArc(arcRect, 270, 90); / 右下角 arcRect.Y = rect.Bottom - diameter; path.AddArc(arcRect, 0, 90); / 左下角 arcRect.X = rect.Left; path.AddArc(arcRect, 90, 90); path.CloseFigure();/闭合曲线 return path; private void Form1_Resize(object sender, EventArgs e) /采用界面二重缓冲 SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); this.Refresh(); SetWindowRegion(); string curFileName=; Bitmap curBitmap; private void btnOpen_Click(object sender, EventArgs e) private void labOpfile_Click(object sender, EventArgs e) OpenFileDialog opfile = new OpenFileDialog(); opfile.Title = 请选择一个图像; opfile.Multiselect = true; opfile.Filter = 所有图像文件|*.jpg;*.png;*.bmp;*.gif; if (opfile.ShowDialog() = DialogResult.OK) try curFileName = op
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 账户管理办法专用户
- 裸光纤业务管理办法
- 中介特殊通道管理办法
- 贺州农村坟地管理办法
- 高中特优班管理办法
- 西安创新券管理办法
- 财务收取票据管理办法
- 高校防疫费管理办法
- 门窗进出库管理办法
- 资产租赁管理办法范本
- 2025版全新离婚协议书:财产分割、子女抚养及离婚后财产保全合同范本
- 石油钻井知识课件
- “学回信精神·助改革发展”专题调研报告
- 2025年医学基础知识题库及答案
- (2025秋新版)苏教版三年级数学上册全册教案
- 2025玉溪市公安局公开招聘警务辅助人员(120人)笔试参考题库附答案解析
- 职业院校实习生考核评价标准
- 水果保鲜的秘密课件
- 纪念中国人民抗日战争暨世界反法西斯战争胜利80周年
- 南京大学课程《普通地质学》教学大纲及教案
- 无人机公开课课件
评论
0/150
提交评论