首页 > 其他分享 >窗口消息框

窗口消息框

时间:2022-09-27 13:46:47浏览次数:40  
标签:MessageBox 窗口 filePath Show 消息 str message AlertService

{
//获取当前运行程序的目录
string fileDir = Environment.CurrentDirectory;
MessageBox.Show(fileDir,"A message from AlertService.");
string filePath = "C:\\JiYF\\BenXH\\BenXHCMS.xml";
MessageBox.Show(filePath,"A message from AlertService.");
string str = "获取文件的全路径:" + System.IO.Path.GetFullPath(filePath); //-->C:\JiYF\BenXH\BenXHCMS.xml
MessageBox.Show(str,"A message from AlertService.");
str = "获取文件所在的目录:" + System.IO.Path.GetDirectoryName(filePath); //-->C:\JiYF\BenXH
MessageBox.Show(str,"A message from AlertService.");
str = "获取文件的名称含有后缀:" + System.IO.Path.GetFileName(filePath); //-->BenXHCMS.xml
MessageBox.Show(str,"A message from AlertService.");
str = "获取文件的名称没有后缀:" + System.IO.Path.GetFileNameWithoutExtension(filePath); //-->BenXHCMS
MessageBox.Show(str,"A message from AlertService.");
str = "获取路径的后缀扩展名称:" + System.IO.Path.GetExtension(filePath); //-->.xml
MessageBox.Show(str,"A message from AlertService.");
str = "获取路径的根目录:" + System.IO.Path.GetPathRoot(filePath); //-->C:\
MessageBox.Show(str, "A message from AlertService.");
}

标签:MessageBox,窗口,filePath,Show,消息,str,message,AlertService
From: https://www.cnblogs.com/abscess/p/16734275.html

相关文章