-
C# 按照扩展名分组文件
C# 按照扩展名分组文件,按照文件类型的不同,对文件进行归类显示,分类清淅便于查看,主要是使用MyFile中的对象和方法实现,核心的功能代码如下:
private void ShowGroupFile(IEnumerable> MyQueryGroup)
{
this.listBox1.Items.Clear();
foreach (var MyFileGroup in MyQueryGroup)
{
this.listBox1.Items.Add("包含" + MyFileGroup.Key + "扩展名的文件如下:");
foreach (var MyFileInfo in MyFileGroup)
{
this.listBox1.Items.Add(MyFileInfo.Name);
}
this.listBox1.Items.Add("");
}
}
static IEnumerable GetFiles(string MyDir)
{
if (!System.IO.Directory.Exists(MyDir))
throw new System.IO.DirectoryNotFoundException();
string[] MyFileNames = null;
List MyFiles = new List();
//查找指定目录下的所有子目录中的所有文件
//MyFileNames = System.IO.Directory.GetFiles(MyDir, "*.*", System.IO.SearchOption.AllDirectories);
MyFileNames = System.IO.Directory.GetFiles(MyDir);
foreach (string MyName in MyFileNames)
{
MyFiles.Add(new System.IO.FileInfo(MyName));
}
return MyFiles;
}
- 2022-12-28 08:15:04下载
- 积分:1
-
104规约IEC60870-5-104
完整的能通过vs2010运行的IEC-104主站和辅站源代码,本人在公司实习亲自编写的。对初学者帮助很大而且对104协议的剖析很清楚。
- 2023-05-22 09:00:20下载
- 积分:1
-
C# 在程序中使用指针、十字光标、浮动窗口等不安全代码
C# 在程序中使用指针、十字光标、浮动窗口等不安全代码的实例,单击以下按钮会演示出对应功能:
在程序中显示一个浮动帮助窗口
显示等待光标
显示十字光标
对于功能实现,逐一分享源代码如下:在程序中使用指针等不安全代码:
var MyFileName = "C:atlog.txt";
var MyReader = new MyReaderClass(MyFileName);
const int MyBuffSize = 128;
byte[] MyBuffer = new byte[MyBuffSize];
ASCIIEncoding MyEncoder = new ASCIIEncoding();
var MyInfo = MyFileName + "的内容如下:";
while (MyReader.Read(MyBuffer, 0, MyBuffSize) != 0)
MyInfo += "
" + MyEncoder.GetString(MyBuffer);
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
private void button2_Click(object sender, EventArgs e)
{//在程序中显示一个浮动帮助窗口
Help.ShowPopup(this, "提高程序开发效率、拓展软件应用领域", new Point(300, 350));
}
private void button3_Click(object sender, EventArgs e)
{//显示等待光标
this.Cursor = Cursors.WaitCursor;
}
private void button4_Click(object sender, EventArgs e)
{//显示十字光标
this.Cursor = Cursors.Cross;
}
- 2023-05-20 08:40:02下载
- 积分:1
-
C# 获取本地打印服务器后台文件的路径
Visual C# MyWinWPF.rar,核心代码分享如下:
private void button1_Click(object sender, RoutedEventArgs e)
{//获取本地打印服务器后台文件的路径
var MyPrintServer = new System.Printing.LocalPrintServer();
string MyInfo = "本地打印服务器后台文件的路径是:" + MyPrintServer.DefaultSpoolDirectory;
MessageBox.Show(MyInfo, "信息提示", MessageBoxButton.OK);
}
- 2022-01-23 11:13:33下载
- 积分:1
-
PX4飞控机身主板源代码
配套硬件配置:
CPU:STM32F205
主频:168 MHz
RAM:256 KB
FLASH:2 MB闪存
传感器:3D ACC /陀螺仪/ MAG/气压
其它:
microSD插槽,5个UART,CAN,I2C,SPI,ADC,等
- 2022-01-28 08:21:53下载
- 积分: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
-
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# 将图像控件的定义导出为XAML文件
C# 将图像控件的定义导出为XAML文件,支持的图像文件:图像文件(JPeg,Gif,Bmp,etc,tiff,png)等。
string MyXAML= System.Windows.Markup.XamlWriter.Save(this.image1);
if (System.IO.File.Exists("MyXaml.xaml"))
System.IO.File.Delete("MyXaml.xaml");
System.IO.File.AppendAllText("MyXaml.xaml", MyXAML);
MessageBox.Show(MyXAML, "MyXaml.xaml文件的内容", MessageBoxButton.OK);
- 2022-04-14 09:51:54下载
- 积分: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
-
C语言公交线路查询助手源码
C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。C语言公交线路查询助手源码。
- 2023-06-28 08:10:04下载
- 积分:1