当前位置:编程学习 > C#/ASP.NET >>

e.state啥意思


Graphics g=e.Graphics; 
//判断菜单项的状态 
if ((e.State & DrawItemState.Selected)==DrawItemState.Selected) 

//绘制背景填充矩形 
g.FillRectangle(new SolidBrush(Color.Red),e.Bounds.Left,e.Bounds.Top,e.Bounds.Width, 
e.Bounds.Height); 
//绘制前景椭圆 
g.DrawEllipse(new Pen(Color.Yellow,2.0f),e.Bounds.Left+5,e.Bounds.Top+3, 
e.Bounds.Width-10,e.Bounds.Height-6); 

else  

   //变换颜色绘制前景和背景 
g.FillRectangle(new SolidBrush(Color.Yellow),e.Bounds.Left,e.Bounds.Top,e.Bounds.Width, 
e.Bounds.Height); 
g.DrawEllipse(new Pen( Color.Red,2.0f),e.Bounds.Left+5,e.Bounds.Top+3, 
e.Bounds.Width-10,e.Bounds.Height-6); 





其中的  


//绘制前景椭圆 
g.DrawEllipse(new Pen(Color.Yellow,2.0f),e.Bounds.Left+5,e.Bounds.Top+3, 
e.Bounds.Width-10,e.Bounds.Height-6); 



这句 if ((e.State & DrawItemState.Selected)==DrawItemState.Selected) 


这里的e.State是什么意思?
State是什么属性 --------------------编程问答-------------------- 状态 --------------------编程问答-------------------- 需要被绘制的项当前状态 --------------------编程问答-------------------- 晕,这个不是标准的Windows控件的Paint方法,肯定是第三方控件中的一个事件方法,看看你用的是什么控件就知道了。
字面理解是状态属性 --------------------编程问答-------------------- 状态 --------------------编程问答-------------------- state就是状态,这地球人都知道 --------------------编程问答-------------------- --------------------编程问答-------------------- 这个事件引起的后果 这个后果承担者的状态 --------------------编程问答-------------------- 这个事件引起的后果 这个后果承担者的状态
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,