-
C# 以WrapWithOverflow方式、Wrap方式、NoWrap方式显示文字
C#以三种方式显示文字,分别以WrapWithOverflow方式、Wrap方式、NoWrap方式将文字显示在窗口中,这三种方式实现的代码请看以下代码:
private void button1_Click(object sender, RoutedEventArgs e)
{//WrapWithOverflow方式
this.MyTextBlock.TextWrapping = System.Windows.TextWrapping.WrapWithOverflow;
}
private void button3_Click(object sender, RoutedEventArgs e)
{//Wrap方式
this.MyTextBlock.TextWrapping = System.Windows.TextWrapping.Wrap;
}
private void button2_Click(object sender, RoutedEventArgs e)
{//NoWrap方式
this.MyTextBlock.TextWrapping = System.Windows.TextWrapping.NoWrap;
}
- 2022-01-25 20:43:04下载
- 积分:1
-
C# 获取当前时区的标准时区名称
C# 获取当前时区的标准时区名称:private void button1_Click(object sender, EventArgs e)
{//获取当前时区的标准时区名称
var MyInfo="当前时区的标准名称是:";
if(TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now))
MyInfo+= TimeZone.CurrentTimeZone.DaylightName;
else
MyInfo+= TimeZone.CurrentTimeZone.StandardName;
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK);
}
- 2022-04-27 18:00:04下载
- 积分:1
-
C# 最经典 简单的progressBar进度条用法示例
这是一个大家都熟悉的实用技巧,用C#制作进度条功能,本代码演示了最简单,且实现方法简单的progressBar进度条用法示例,
单击按钮后,开始演示进度条效果,这部分代码写在按钮事件中:
progressBar1.Value = 0;//设置进度条的初始值
progressBar1.Minimum = 0;//设置progressBar1控件的Minimum值为0
progressBar1.Maximum = 500;//设置progressBar1的Maximum值为500
progressBar1.Step = 1;//设置progressBar1的增值为1
for (int i = 0; i < 500; i++)//调用for语句循环递增
{
progressBar1.PerformStep();//使用PerformStep方法按Step值递增
textBox1.Text = "进度值:" + progressBar1.Value.ToString();
}
- 2022-08-18 01:25:55下载
- 积分:1
-
C# 演示如何使用DataGridView更新数据
C#更新修改DataGridView数据,请直接在DataGridView表格中修改数据,C# 更新DataGridView数据的实现代码如下:
private void button1_Click(object sender, EventArgs e)
{//更新数据
var MyCount = this.sqlDataAdapter1.Update(this.dataSet1, "Customers");
var MyInfo = "成功更新" + MyCount.ToString() + "条记录!";
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK);
}
private void Form1_Load(object sender, EventArgs e)
{//读取Customers数据表记录
var MySQL = "Select * From Customers ";
this.sqlConnection1.ConnectionString = "Data Source=.SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True";
this.sqlCommand1 = new System.Data.SqlClient.SqlCommand("Select * From Employees", this.sqlConnection1);
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(this.sqlCommand1);
this.sqlCommandBuilder1 = new System.Data.SqlClient.SqlCommandBuilder(this.sqlDataAdapter1);
this.sqlDataAdapter1.Fill(this.dataSet1, "Customers");
this.dataGridView1.DataSource = this.dataSet1.Tables[0];
- 2022-03-24 05:10:10下载
- 积分:1
-
C# 启动和关闭无窗体定时器
C# 启动和关闭无窗体定时器,单击窗体上对应的按钮,即可完成无窗体定时器的启动和关闭功能,核心代码为:
private void button1_Click(object sender, EventArgs e)
{//启动无窗体定时器
var MyClass = new MyThreadClass();
MyTimer = new System.Threading.Timer(MyClass.MyCallBackMethod, MyClass, 5000, 2000);
}
private void button2_Click(object sender, EventArgs e)
{//关闭无窗体定时器
MyTimer.Dispose();
}
- 2022-04-09 03:53:39下载
- 积分:1
-
C# 以阴影效果显示列表控件
C# 以阴影效果显示ListBox列表控件,为ListBox显示列表控件增加渐变阴影效果,最终效果如图所示,阴影效果呈现向外扩散的渐变效果,实现方法简单,仅供参考。
- 2022-04-02 01:34:44下载
- 积分:1
-
某超市进销存管理系统(C++_Oracle开发源码)
某超市进销存管理系统(C++_Oracle开发源码)
- 2022-11-23 22:55:04下载
- 积分:1
-
C#将checkbox应用于combobox中 源码实例
C#将checkbox应用于combobox中 源码实例,在下拉列表combobox中增加复选框按钮的用法实例,这些用法包括排列布局、数量分配等,在演示窗口的按钮中,单击按钮可看到不同的运用效果,这在平时的使用中,会大大扩展combox的功能。
- 2022-08-20 12:13:56下载
- 积分:1
-
MFC股票软件源码
MFC股票软件源码,用来分析股票数据。
- 2022-07-06 19:06:18下载
- 积分:1
-
C# wpf 创建简单形状动画的例子
C# wpf 创建简单形状动画的例子,启动动画、停止动画、暂停动画、继续动画、加速动画。创建动画
Rectangle MyRectangle = new Rectangle();
MyRectangle.Width = 50;
MyRectangle.Height = 20;
MyRectangle.Margin = new Thickness(10, 50, 0, 0);
MyRectangle.Fill = new LinearGradientBrush(
Color.FromArgb(255, 0, 255, 255), Color.FromArgb(255, 0, 0, 255), 0);
MyRectangle.HorizontalAlignment = HorizontalAlignment.Left;
this.canvas1.Children.Add(MyRectangle);
this.RegisterName("MyRectangle", MyRectangle);
DoubleAnimation MyAnimation =
new DoubleAnimation(100, 380, new Duration(TimeSpan.FromSeconds(5)));
Storyboard.SetTargetName(MyAnimation, "MyRectangle");
Storyboard.SetTargetProperty(MyAnimation,
new PropertyPath(Rectangle.WidthProperty));
MyStoryboard = new Storyboard();
MyStoryboard.Children.Add(MyAnimation);
动画效果请参见下图所示,源代码请单击下载按钮下载。
- 2022-08-25 13:04:57下载
- 积分:1