-
C#保存和显示XML图像文件
C#保存和显示XML图像文件的源码,本程序实现的功能主要是打开一个图像,格式为JPeg, Gif, Bmp, etc等,然后可保存XML图像文件,还可显示显示XML图像文件,每一步操作都会以MessageBox.Show的方式弹出对话框提示。
- 2023-06-27 15:40:04下载
- 积分:1
-
C#在listView自定义imageList图标列表
C#在listView自定义imageList图标列表,实际上是创建了一个图像列表的Listview列表,我们可以将一些菜单条目做成此类型,以图标的风格展现操作选项,本实例中你可以熟悉imageList、listView1列表项的添加与删除。
下面是关键的代码:
listView1.LargeImageList = imageList1;
imageList1.ImageSize = new Size(37,36);
imageList1.Images.Add(Image.FromFile("01.png"));调用图标显示的图像资源
imageList1.Images.Add(Image.FromFile("02.png"));
listView1.SmallImageList = imageList1;
listView1.Items.Add("明日科技");图标下边显示的文字
listView1.Items.Add("C#编程词典");
listView1.Items[0].ImageIndex = 0;
listView1.Items[1].ImageIndex = 1;
- 2023-03-09 08:05:03下载
- 积分:1
-
C# 对组合查询后的结果进行升序、降序排序
C# 对组合查询后的结果进行排序,排序包括了升序、降序排列。查询到数据后,单击窗口中的对应按钮即可实现对应的排序操作,核心代码的编写有如下参考:
string P_Str_ConnectionStr = string.Format(//创建数据库连接字符串
@"server=WIN-GI7E47AND9RLS;database=db_TomeTwo;uid=sa;pwd=");
string P_Str_SqlStr = string.Format(//创建SQL查询字符串
@"SELECT 年龄 AS 信息 FROM tb_Student UNION SELECT 总分 FROM tb_grade UNION SELECT 课程编号 FROM tb_course ORDER BY 信息 ASC");
SqlDataAdapter P_SqlDataAdapter = new SqlDataAdapter(//创建数据适配器
P_Str_SqlStr, P_Str_ConnectionStr);
DataTable P_dt = new DataTable();//创建数据表
P_SqlDataAdapter.Fill(P_dt);//填充数据表
return P_dt;//返回数据表
- 2022-05-06 02:20:47下载
- 积分:1
-
C# 查询数据库时不显示重复记录
C# 查询数据库时不显示重复记录,以查询已销售图书信息为例,演示如果略过重复数据,不显示重复的数据记录。
string P_Str_ConnectionStr = string.Format(//创建数据库连接字符串
@"server=WIN-GI7E47AND9RLS;database=db_TomeTwo;uid=sa;pwd=");
string P_Str_SqlStr = string.Format(//创建SQL查询字符串
"SELECT 书号,条形码,书名,作者,出版社 FROM tb_Book");
SqlDataAdapter P_SqlDataAdapter = new SqlDataAdapter(//创建数据适配器
P_Str_SqlStr, P_Str_ConnectionStr);
DataTable P_dt = new DataTable();//创建数据表
P_SqlDataAdapter.Fill(P_dt);//填充数据表
return P_dt;//返回数据表
- 2022-06-11 17:53:03下载
- 积分:1
-
一个简单的C# 多线程实例
一个简单的C# 多线程实例,创建多线程的简单实例,创建线程一和线程二,两者单独完成指定侨任务,创建多线程主要是使用C#中内置的方法new Thread()来实现,然后让每个线程执行一个for循环,来测试线程运行的效果。创建线程和运行线程的代码,可参考如下代码:
Thread thread1 = new Thread(new ThreadStart( Count));
thread1.Name="线程一";
Thread thread2 = new Thread(new ThreadStart( Count));
thread2.Name="线程二";
thread1.Start();
thread2.Start();
- 2022-08-18 15:51:20下载
- 积分:1
-
C# 制作勤劳的小闹钟
C# 制作勤劳的小闹钟,将时间信息显示在textBox文本框中,textBox1.Text = DateTime.Now.ToString("HH时mm分ss秒");//在TextBox控件中显示系统时间。最终的运行效果如测试运行图所示,比较简单的小闹钟,C#新手参考。时间字体样式在代码中可以自定义,不喜欢这种时钟字体的,就自己修改吧。
- 2022-06-13 03:03:05下载
- 积分:1
-
w5500 DHCP 客户端 源代码
官方的DHCP 客户端源代码,经本人亲自验证 100% 可用。
- 2023-05-25 06:20:04下载
- 积分:1
-
7Zip
This file is part of SevenZipSharp. SevenZipSharp is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SevenZipSharp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SevenZipSharp. If not, see .
- 2022-07-20 00:09:31下载
- 积分:1
-
C# 在密钥容器中创建非对称密钥
在密钥容器中创建非对称密钥、在密钥容器中删除非对称密钥、在密钥容器中获取非对称密钥,具体的实现代码,请参考如下代码:
private void button1_Click(object sender, EventArgs e)
{//在密钥容器中创建非对称密钥
CspParameters MyCSP = new CspParameters();
MyCSP.KeyContainerName = this.textBox2.Text;
RSACryptoServiceProvider MyRSA = new RSACryptoServiceProvider(MyCSP);
this.textBox1.Text=MyRSA.ToXmlString(true);
}
private void button2_Click(object sender, EventArgs e)
{//在密钥容器中删除非对称密钥
CspParameters MyCSP = new CspParameters();
MyCSP.KeyContainerName = this.textBox2.Text;
RSACryptoServiceProvider MyRSA = new RSACryptoServiceProvider(MyCSP);
MyRSA.PersistKeyInCsp = false;
MyRSA.Clear();
try
{
this.textBox1.Text = MyRSA.ToXmlString(true);
}
catch
{
this.textBox1.Text = "已经删除非对称密钥!";
}
}
private void button3_Click(object sender, EventArgs e)
{//在密钥容器中获取非对称密钥
CspParameters MyCSP = new CspParameters();
MyCSP.KeyContainerName = this.textB
- 2022-02-06 13:18:17下载
- 积分:1
-
C# 为DataGridView控件的新行指定默认值
C# 为DataGridView控件的新行指定默认值,双击DataGridView.rar即可看到默认值,一般情况下,单元格是空的没有任何内容,实现这一功能,其实也简单,如下代码示:
private void shippersDataGridView_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
{//为DataGridView控件的新行指定默认值(测试时直接单击最下面的空白行即可)
e.Row.Cells[1].Value = "重庆长安捷达运输公司";
e.Row.Cells[2].Value = "023-40405690";
shippersBindingSource.AddNew();
}
- 2022-03-01 05:33:46下载
- 积分:1