-
w5500 DHCP 客户端 源代码
官方的DHCP 客户端源代码,经本人亲自验证 100% 可用。
- 2023-05-25 06:20:04下载
- 积分:1
-
C# 使用Binding对象读取图像字段
C# 数据库操作实例,使用Binding对象从数据库中读取图像字段,同时还演示了从SQL Server数据库读取图像,向SQL Server数据库添加图像。
向SQL Server数据库添加图像主要是在SQL Server Northwind数据库中创建图像数据表,添加图像数据参数值,从SQL Server数据库读取图像的代码如下:
private void button2_Click(object sender, EventArgs e)
{//从SQL Server数据库读取图像
var MySQL = "Select * From MyImageTable ";
var MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True");
var MySet = new DataSet();
var MyAdapter = new System.Data.SqlClient.SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MySet);
byte[] MyBytes = (byte[])MySet.Tables[0].Rows[0]["ImageData"];
var MyStream = new System.IO.MemoryStream(MyBytes);
this.pictureBox1.Image = Image.FromStream(MyStream);
}
- 2022-01-25 16:04:56下载
- 积分:1
-
C# wpf方法的最大化和最小化窗口
Viaual C# 使用wpf方法实现最大化和最小化窗口,和默认的方式似乎有些不同.有兴趣的可参考以下代码:
private void button1_Click(object sender, RoutedEventArgs e)
{//最大化显示窗口
this.WindowState = System.Windows.WindowState.Maximized;
}
private void button2_Click(object sender, RoutedEventArgs e)
{//最小化显示窗口
this.WindowState = System.Windows.WindowState.Minimized;
}
private void button3_Click(object sender, RoutedEventArgs e)
{//还原窗口
this.WindowState = System.Windows.WindowState.Normal;
}
private void button4_Click(object sender, RoutedEventArgs e)
{//关闭窗口
this.Close();
}
- 2022-01-25 15:01:45下载
- 积分:1
-
C# 键盘Ctrl+g控制蜂鸣器播放声音
Visual C#播放声音,运行程序后,操作键盘上的Ctrl+g组合键发出蜂鸣声...这里的拖放声音是蜂鸣声,从音箱里发出,并不是从机箱的蜂鸣器发声。实现的过程和细节代码如下:
//导入 Windows Beep() API 函数
[DllImport("kernel32.dll")]
private static extern bool Beep(int freq, int dur);
// 定义PlaySound()要使用的常数
public const int SND_FILENAME = 0x00020000;
public const int SND_ASYNC = 0x0001;
// 导入 Windows PlaySound() 函数
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound,
int hmod,
int fdwSound);
[STAThread]
static void Main(string[] args)
{
// 使用Ctrl+g发出蜂鸣声
Console.Write("a");
Console.WriteLine("使用Ctrl+g发出蜂鸣声...");
Console.ReadLine();
// 使用 Windows API 发出蜂鸣声
Beep(800, 200);
Console.WriteLine("使用 Windows API 发出蜂鸣声...");
Console.ReadLine();
// 播放bells.wav文件
PlaySound("bells.wav",
0,
SND_FILENAME | SND_ASYNC);
Console.WriteLine("播放bells.wav文件...");
Console.ReadLine();
}
- 2022-05-23 17:14:52下载
- 积分:1
-
半条命II游戏源代码
半条命II游戏源代码,这是完整的企业级游戏源码,采用vc6编写。是开发大型游戏的必备参考,非常有价值。
- 2022-03-23 19:15:28下载
- 积分:1
-
录音程序
自己做的小程序,在VC++6.0下编译通过
- 2022-02-28 14:04:03下载
- 积分:1
-
C# 根据用户输入的防伪码生成随机数
C# 根据用户输入的防伪码生成随机数,测试时请输入防伪码的长度和个数(以空格来分开),请键入任意字符以结束,这个过程适时显示生成个数:{0},运行时间:{1}ms。根据指定字符生成随机数,这个在平时应用广泛,希望这个源码在生成随机数方面会给你一定参考。
- 2022-02-01 00:12:10下载
- 积分:1
-
C#实现的俄罗斯方块程序(源码)
C#实现的俄罗斯方块程序(源码).C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)C#实现的俄罗斯方块程序(源码)
- 2023-05-20 13:10:03下载
- 积分:1
-
C# 实现凹凸按钮(立体按钮效果)
Visual C# 实现凹凸按钮(立体按钮效果),鼠标放在按钮上,按下鼠标左键,即可看到凹凸效果:
private void Window_Loaded(object sender, RoutedEventArgs e)
{//(上凸效果)
BevelBitmapEffect MyBevelEffect = new BevelBitmapEffect();
MyBevelEffect.BevelWidth = 20;
MyBevelEffect.EdgeProfile = EdgeProfile.CurvedIn;
MyBevelEffect.LightAngle = 320;
MyBevelEffect.Relief = 0.4;
MyBevelEffect.Smoothness = 0.4;
this.button1.BitmapEffect = MyBevelEffect;
bShift = true;
}
private void button1_Click(object sender, RoutedEventArgs e)
{//凹凸显示按钮(下凸效果)
if (bShift)
{
BevelBitmapEffect MyBevelEffect = new BevelBitmapEffect();
MyBevelEffect.BevelWidth = 20;
this.button1.BitmapEffect = MyBevelEffect;
bShift = false;
}
else
{
BevelBitmapEffect MyBevelEffect = new BevelBitmapEffect();
MyBevelEffect.BevelWidth = 20;
MyBevelEffect.EdgeProfile = EdgeProfile.CurvedIn;
MyBevelEffect.Ligh
- 2022-04-20 03:11:38下载
- 积分:1
-
C#读取数据库内容并在dataGridView中显示
C#从数据库中读取内容并显示在dataGridView中,这似乎是一个很实用的功能,在数据库应用的时候,我们都要通过dataGridView来显示数据,这个例子可帮助初学者很好的掌握此功能的具体实现,一些代码片段分享如下:
private void button1_Click(object sender, EventArgs e)
{
//实例化SqlConnection变量conn,连接数据库
conn = new SqlConnection("server=.;database=db_15;uid=sa;pwd=");
//实例化SqlDataAdapter对象
SqlDataAdapter sda = new SqlDataAdapter("select * from tb_emp", conn);
DataSet ds = new DataSet(); //实例化DataSet对象
sda.Fill(ds);//使用SqlDataAdapter对象的Fill方法填充DataSet
dataGridView1.DataSource = ds.Tables[0];//设置dataGridView1控件的数据源
dataGridView1.RowHeadersVisible = false;//禁止显示行标题
//使用for循环设置控件的列宽
for (int i = 0; i < dataGridView1.ColumnCount; i++)
{
dataGridView1.Columns[i].Width = 84;
}
button1.Enabled = false;//禁用按钮
dataGridView1.Columns[0].ReadOnly = true;//将控件设置为只读
}
private DataTable dbconn(string strSql)//建立一个DataTable类型的方法
{
this.adapter = new SqlDataAdapter(strSql, conn);//实例化SqlDataAdapter对
- 2022-07-24 21:44:03下载
- 积分:1