01.using System;
02.using System.Collections.Generic;
03.using System.ComponentModel;
04.using System.Data;
05.using System.Drawing;
06.using System.Text;
07.using System.Windows.Forms;
08.
09.namespace GetDeskDirectory
10.{
11. public partial class Form1 : Form
12. {
13. public Form1()
14. {
15. InitializeComponent();
16. }
17.
18. private void button1_Click(object sender, EventArgs e)
19. {
20. string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
21. MessageBox.Show("桌面的路径是"+dir);
22. }
23. }
24.}
获取当前系统桌面路径(C# 代码)
最新推荐文章于 2024-08-04 03:01:25 发布
本文提供了一个使用C#获取当前用户桌面路径的简单示例代码。通过调用Environment类的GetFolderPath方法并传入SpecialFolder.DesktopDirectory枚举值来实现。此代码适用于Windows桌面应用程序中快速定位到用户的桌面目录。
6069

被折叠的 条评论
为什么被折叠?



