首页|操作系统|软件开发|网页制作|媒体动画|数据库|ASP教程|ASP.NET教程|PHP教程|JSP教程|XML教程|建站资料|软件学院|行业资讯|平面设计|网络安全|晒IT论坛|IT人才
  位置: 晒IT >> ASP.NET教程 >> Asp.Net实例教程 >> 正文
 
 
可用来显示空值的时间选择控件5
可用来显示空值的时间选择控件5
 
 


return ;

}

else

{

Point pos = this.Location ;

pos.Y = pos.Y + this.Height ;

pos = this.Parent.PointToScreen(pos) ;

pos = SetCalendarPos(pos,frmCalendar) ;

frmCalendar.SetDesktopLocation(pos.X,pos.Y) ;

frmCalendar.Visible = true ;

}



}

private Point SetCalendarPos(Point sPos,Control ConToShow)

{

Point NewPos =new Point(sPos.X,sPos.Y);

int iConWidth = ConToShow.Width ;

int iConHeight = ConToShow.Height ;

int iScrWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width ;

int iScrHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height ;

if (sPos.Y + iConHeight>iScrHeight)

NewPos.Y = iScrHeight - iConHeight ;



if (sPos.X + iConwidth>iScrWidth)

NewPos.X = iScrWidth - iConWidth ;



return NewPos ;

}

private void lbSpace_Click(object sender, System.EventArgs e)

{

if (this.DesignMode)

return ;

tbDay.Focus() ;

tbDay.SelectAll() ;

}



private void lbSep1_EnabledChanged(object sender, System.EventArgs e)

{

Label label = (Label)sender;

if (label.Enabled)

label.BackColor = Color.FromKnownColor(KnownColor.Window) ;

else

label.BackColor = Color.FromKnownColor(KnownColor.Control) ;

}



}//end class

public class DateFormatConverter:System.ComponentModel.StringConverter

{

///



/// 根据返回值确定是否支持下拉框的形式



///




///



/// true: 下拉框的形式



/// false: 普通文本编辑的形式



///




public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context)



{



return true;



}





///



/// 下拉框中具体的内容



///




public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)

{

return new StandardValuesCollection(new string[]{"yyyy-MM-dd","yyyy.MM.dd","yyyy/MM/dd","yyyy年MM月dd日","自定义"});



}



public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type sourceType)

{

if( sourceType == typeof(string) )

return true;

else

return base.CanConvertFrom(context, sourceType);

}



///



/// 根据返回值确定是否是不可编辑的文本框



///




///



/// true: 文本框不可以编辑



/// flase: 文本框可以编辑



///




public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context)



{

return true;

}





}



}//end namespace


上一页  [1] [2] 
  • 上一篇: 可用来显示空值的时间选择控件3
  • 下一篇: 没有了
  •  告诉好友  打印此文 关闭窗口 返回顶部
     
    热点文章
     
     
    推荐文章
     
     
    相关文章

    | 设为首页 | 加入收藏 | 联系我们 | 友情链接 | 诚聘英才 |
    Copyright© 2008 ShaiIT.Com .All Rights Reserved
    下载alexa工具,提升您的网站排名