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

Reading number is top 10 articles
C#中父窗口和子窗口之间实现控件互操作_[Asp.Net教程]
HTML 表格特效整理_[Html教程]
c#判断数据NULL值的方法_[Asp.Net教程]
基于.NET数字处理程序的框架设计_.net资料_编程技术
web.config配置文件示例_[Asp.Net教程]
ASP.NET2.0中Gridview的使用技巧_[Asp.Net教程]
SQL,Server之分布式事务_mssql学习_编程技术
HTML语言剖析(六)清单标记_[Html教程]
visual c++中静态文本控件(Static Text)
PHP+Ajax 实现分页技术_[PHP教程]
Reading number is top 10 pictures
粉红蕾丝的美女
NeedWallpaper12
避免防盗门的猫眼变成钥匙眼
好身材能把衣服穿出3D效果
Average female college students3
The real super beauty1
10 powerless things in life
这两天,中国人民到处都可以“看海”了
Exquisite decoration is not paying too much2
Absolutely shocked. National geographic 50 animal photographys7
Download software ranking
星际争霸1.08硬盘免安装版
Prostitutes diary
Boxer vs Yellow2
Tram sex maniac 2 (H) rar bag10
Boxer Classic video3
Ashlynn Video4
linux安装大全
Such love down(擒爱记)
双旗镇刀客B
Unix video tutorial14
qq published in(发表于) 2014/7/11 9:17:33 Edit(编辑)
C#中MonthCalendar控件应用实例

C#中MonthCalendar控件应用实例

C#中MonthCalendar控件应用实例

MonthCalendar控件

功能

MonthCalendar控件为用户查看和设置日期信息提供了一个直观的图形界面。该控件以网格形式显示日历,网格包含月份的编号日期,这些日期排列在周一到周日下的7个列中,并且突出显示选定的日期范围。可以单击月份标题任何一侧的箭头按钮来选择不同的月份,与DateTimePicker控件不同的是,开发人员可以使用该控件选择多个日期。图1为MonthCalendar控件。



图1 MonthCalendar x控件

2.属性

MonthCalendar控件常用属性及说明如表1所示。



表1 MonthCalendar控件常用属性及说明

下面对比较重要的属性进行详细介绍。

(1)ShowToday属性。此属性把今天的日期显示在控件底部。

语法:

public bool ShowToday { get; set; }

属性值:如果显示的是今天的日期,为True;否则为False。默认值为True。

(2)howTodayCircle属性。此属性用来将今天的日期显示为圆形。

语法:

public bool ShowTodayCircle { get; set; }

属性值:如果在今天的日期上加圆圈,则为True;否则为False。默认值为True。

示例

ShowTodayCircle属性的使用

本示例中,当程序运行时,单击【ShowTodayCircle属性】按钮,在该按钮的Click事件中设置MonthCalendar控件的ShowTodayCircle属性,以便在当前的日期上加圆圈。

程序主要代码如下:

private void button2_Click(object sender, EventArgs e)

{

this.monthCalendar1.ShowTodayCircle = True;

}

3.方法

AddBoldedDate方法用于在月历中添加以粗体显示的日期。

语法:

public void AddBoldedDate (DateTime date)

date:要以粗体显示的日期。

完整程序代码如下:

★★★★★主程序文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace _8_14

{

static class Program

{

///



/// 应用程序的主入口点。

///


[STAThread]

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new frmMonthCalendar());

}

}

}

★★★★★frmMonthCalendar窗体设计文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace _8_14

{

public partial class frmMonthCalendar : Form

{

public frmMonthCalendar()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

}

private void button2_Click(object sender, EventArgs e)

{

this.monthCalendar1.ShowTodayCircle = true;

}

private void button3_Click(object sender, EventArgs e)

{

}

private void frmMonthCalendar_Load(object sender, EventArgs e)

{

}

}

}

★★★★★frmMonthCalendar窗体代码文件完整程序代码★★★★★

namespace _8_14

{

partial class frmMonthCalendar

{

///

/// 必需的设计器变量。

///


private System.ComponentModel.IContainer components = null;

///

/// 清理所有正在使用的资源。

///


/// 如果应释放托管资源,为 true;否则为 false。

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows 窗体设计器生成的代码

///

/// 设计器支持所需的方法 - 不要

/// 使用代码编辑器修改此方法的内容。

///


private void InitializeComponent()

{

this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();

this.button2 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// monthCalendar1

//

this.monthCalendar1.Location = new System.Drawing.Point(34, 5);

this.monthCalendar1.Name = "monthCalendar1";


添加到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.