All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
优秀ASP.NET程序员修炼之路_[Asp.Net教程]
Windows,IIS环境下安装和配置PHP开发环境_php资料_编程技术
ASP.NET从零起步设计网站全过程(6)_[Asp.Net教程]
在ASP.NET中运用JavaScript_[Asp.Net教程]
使用c#捕获windows的关机事件_.net资料_编程技术
解决SQL Server导入数据时id自增属性丢失_[SQL Server教程]
Asp.net,控件开发(八)之复合控件(二)之复合控件视图幕后机制_[Asp.Net教程]
ASP.NET,2.0中CSS失效的问题总结_[Asp.Net教程]
一种通过sql,server的作业调度+存储过程来建立自动备份的方法_[SQL,Server教程]
ASP.NET,2.0中判断上传的图片是否符合规格_[Asp.Net教程]
Reading number is top 10 pictures
Born After 90 Beijing sports university campus flower photos5
传奇套装
各种囧况!玩游戏最不喜欢出现的十件事(点评)
Sora aoi possession photo1
中国女孩大胆自拍,显露完美身材
陪睡门马睿菈自曝写真 称首拍大尺度照片2
Chinese paper-cut grilles art appreciation2
From China fortress sora aoi4
The household design, do not do bridal chamber a pity
The mother was a stay-at-home children too tired took three baby suicide
Download software ranking
VeryCD电驴(EasyMule) V1.1.9 Build09081
C++教程第四版
Sora aoi 120 minutes
linux初级教程
jdk1.5
Professional killers2 data package
Ashlynn Video4
Unix video tutorial3
网络管理员第三版
Be there or be square
aaa published in(发表于) 2013/12/15 8:54:45 Edit(编辑)
讲解:自己做出VS.NET风格的右键菜单_.net资料_编程技术

讲解:自己做出VS.NET风格的右键菜单_.net资料_编程技术

讲解:自己做出VS.NET风格的右键菜单_.net资料_编程技术-你的首页-uuhomepage.com

  自己做出VS.NET风格的右键菜单(简单,实用)


  此主题相关图片如下:class MyMenuItem : System.Windows.Forms.MenuItem


{
public MyMenuItem()
{
//这里很重要,必须把OwerDraw设为true,这样可以自己画菜单,否则便是让操作系统画菜单了,默认的是false
this.OwnerDraw=true;
}
protected override void OnDrawItem(SysDrawItemEventArgs e)
{
//要重画菜单,是没有OnPaint方法重载的,只有重载OnDrawItem方法!
Graphics g=e.Graphics;
g.SmoothingMode=SmoothingMode.AntiAlias;//抗锯齿
Font f = new Font(FontFamily.GenericSerif, 12, FontStyle.Regular, GraphicsUnit.Pixel);//设定菜单的字体
Pen p=new Pen(Color.Navy,1);//这是画边框的字体
if(e.State==DrawItemState.NoAccelerator)//一开始右键单击出现菜单,但是鼠标并没有移上去
{ //用白色的底色
g.FillRectangle(Brushes.WhiteSmoke,e.Bounds.X-2,e.Bounds.Y-2,121,23);
}
//鼠标移上去,但是并没有单击
if ((e.State &DrawItemState.Selected)==DrawItemState.Selected)
{
//花边框和底色
g.FillRectangle(Brushes.LightSteelBlue,e.Bounds.X,e.Bounds.Y,109,20);
g.DrawLine(p,e.Bounds.X,e.Bounds.Y,e.Bounds.X,e.Bounds.Y+19);
g.DrawLine(p,e.Bounds.X,e.Bounds.Y+19,e.Bounds.X+109,e.Bounds.Y+19);
g.DrawLine(p,e.Bounds.X+109,e.Bounds.Y+19,e.Bounds.X+109,e.Bounds.Y);
g.DrawLine(p,e.Bounds.X+109,e.Bounds.Y,e.Bounds.X,e.Bounds.Y);
}
//显示文字
g.DrawString(this.Text,f,Brushes.Black,e.Bounds.X,e.Bounds.Y);
g.Dispose();
}
//这是很重要的,这给你的菜单定义了大小,高20,宽100,否则你的菜单什么也看不到
protected override void OnMeasureItem(MeasureItemEventArgs e)
{
e.ItemHeight=20;
e.ItemWidth=100;
}
}



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.