-
C# SelectionStart SelectionEnd时间段选择日历范例
C# Calendar 时间段选择日历范例,可选择时间区间,调用 了C#中的SelectionStart SelectionEnd日期函数实现的功能,这个程序演示了两种功能:
1、获取控件当前的日期和时间
textBox1.Text = monthCalendar1.TodayDate.ToString();
2、时间起始段的选择:
通过SelectionStart属性获取用户选择的起始日期
textBox2.Text = monthCalendar1.SelectionStart.ToString();
通过SelectionEnd属性获取用户选择的结束日期
textBox3.Text = monthCalendar1.SelectionEnd.ToString();
- 2022-08-15 10:37:28下载
- 积分:1
-
C# dateTimePicker 日历控件 弹出式日期选择
C# 实现一个dateTimePicker 日历控件,单击后弹出式日期选择框,比较 经典的操作方法和界面风格。
当用户点击日期选择按钮后,会执行以下函数代码:
private void Form1_Load(object sender, EventArgs e)
{
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
label1.Text = dateTimePicker1.Text;
}
弹出的日期选择形式如下图所示,完整源码请下载 。
- 2023-02-13 07:35:03下载
- 积分:1
-
activeMQ C++源码
activeMQ C++源码 ,C++写的源代码,网上找到的,分享给大家。
- 2022-09-14 21:05:04下载
- 积分:1
-
C# 文件分块器-文件分割
C# 文件分块器,把文件分割成若干个文件块,在存储一些大文件时,这个功能可以用上。本程序运行的界面截图如下图所示,用户可以自己设定需要分块的文件长度、分块长度、分块数等,然后进行拆分,还可以按这个规则进行组装,是拆分的逆过程,这个挺有意思埃学习C#文件操作,必看的一个小例子。
- 2022-03-13 00:26:14下载
- 积分:1
-
C# 文件上载/下载器程序源码示例
一个挺基础的Visual C# 文件上载/下载器程序源码示例,从指定网址下载文件到本机。下载文件使用client.DownloadFile(),上传文件使用client.UploadFile(),使用指定的方法将指定的本地文件上载到指定的资源。程序要用到一个三方控件:File Downloader and Uploader.dll,请放于Debug目录下,与exe同级,运行时供调用。
- 2022-02-28 16:20:26下载
- 积分:1
-
C# 获取DataGridView鼠标单击单元格值
C# 单击 鼠标获取DataGridView单元格的值,这个例子需要连接SQL数据库,测试时候没连接成功,截图也不准确,请大家下载源码,自己配置环境调试吧,这是核心代码部分:
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{//获取DataGridView鼠标单击单元格值
var MyInfo = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
MessageBox.Show("刚才的选择是:" + MyInfo, "信息提示", MessageBoxButtons.OK);
}
private void dataGridView1_MouseUp(object sender, MouseEventArgs e)
{//单击鼠标获取DataGridView单元格值
var MyHit = this.dataGridView1.HitTest(e.X, e.Y);
if (MyHit.RowIndex >= 0)
{
this.dataGridView1.Select();
var MyInfo = this.dataGridView1.Rows[MyHit.RowIndex].Cells[MyHit.ColumnIndex].Value.ToString();
MessageBox.Show("刚才的选择是:" + MyInfo, "信息提示", MessageBoxButtons.OK);
}
}
- 2022-07-18 18:54:50下载
- 积分:1
-
基于C#的右下角窗体弹出实例+源代码基于C#的右下角窗体弹出实例+源代码基于C#的右下角窗体弹出实例+源代码
基于C#的右下角窗体弹出实例+源代码基于C#的右下角窗体弹出实例+源代码基于C#的右下角窗体弹出实例+源代码基于C#的右下角窗体弹出实例+源代码
- 2022-02-12 22:25:41下载
- 积分:1
-
C# WPF把彩色图片转换为灰度图
C# 把彩色图片转换为灰度图,这是一个基于WPF的C#图像处理程序,图像彩色转换黑白,支持的图像文件格式为:JPeg,Gif,Bmp,etc。
程序主要实现两个功能,一是将彩色转换为索引像素格式、二是将彩色转换为黑白像素格式,对应于窗口中的按钮,可查看对应功能的演示:
将彩色转换为黑白像素格式,核心代码如下:
TransformedBitmap MyRotatedBitmapSource = new TransformedBitmap();
MyRotatedBitmapSource.BeginInit();
MyRotatedBitmapSource.Source = (System.Windows.Media.Imaging.BitmapSource)this.image1.Source;
MyRotatedBitmapSource.Transform = new RotateTransform(270);
MyRotatedBitmapSource.EndInit();
FormatConvertedBitmap MyFormatedBitmap = new FormatConvertedBitmap();
MyFormatedBitmap.BeginInit();
MyFormatedBitmap.Source = MyRotatedBitmapSource;
MyFormatedBitmap.DestinationFormat = PixelFormats.BlackWhite;
MyFormatedBitmap.EndInit();
this.image1.Source = MyFormatedBitmap;
完整源码例子请在本页下载,运行效果截图如下图示。
- 2022-02-01 21:42:57下载
- 积分:1
-
C# 使用虚方法实现用户登录
C# 使用虚方法实现用户登录,这里需要创建密封类, 密封并重写基类中的Login方法,然后再编写处理函数完成以下代码:
myClass2 myclass2 = new myClass2(); //实例化密封类对象
Console.Write("请输入用户名:");
myclass2.Name = Console.ReadLine(); //为密封类中的用户姓名赋值
Console.Write("请输入密码:");
myclass2.Pwd = Console.ReadLine();//为密封类中的用户密码赋值
myclass2.Login();//调用密封类中的密封方法
- 2022-02-25 18:17:12下载
- 积分:1
-
C# 创建一个泛型接口
C# 创建一个泛型接口的例子,创建一个泛型接口的代码和方法如下:
public interface IGenericInterface {
T CreateInstance(); //接口中调用CreateInstance方法
}
//实现上面泛型接口的泛型类
//派生约束where T : TI(T要继承自TI)
//构造函数约束where T : new()(T可以实例化)
public class Factory : IGenericInterface where T : TI, new()
{
public TI CreateInstance()//创建一个公共方法CreateInstance
{
return new T();
}
}
class Program
{
static void Main(string[] args)
{
//实例化接口
IGenericInterface factory =
Factory();
//输出指定泛型的类型
Console.WriteLine(factory.CreateInstance().GetType().ToString());
Console.ReadLine();
}
}
- 2022-03-11 00:59:39下载
- 积分:1