C# webrowser 控件设置打开页面问题

string strPath = Application.StartupPath;//表示该应用所在的起始目录 //strPath=“E:\C#project\MagicCony\MagicCony\bin\Debug”

​ strPath = strPath.Substring(0,strPath.LastIndexOf("\\"));//截取路径,

//strPath=“E:\C#project\MagicCony\MagicCony\bin”

​ strPath = strPath.Substring(0, strPath.LastIndexOf("\\"));

//strPath=“E:\C#project\MagicCony\MagicCony”

​ strPath += @"\search.htm";

//strPath=“E:\C#project\MagicCony\MagicCony\search.htm”

​ webBrowser1.Navigate(strPath);

这是给webrowser 控件设置打开页面的代码

Substring(int startindex,int length);

Startindex:表示开始截取位置;Length:表示截取长度;

lastindexof(string value);

在从零开始的字符串中,截取从0到最后一次出现字符串value的长度

strPath += @"\search.htm";

=strPath+="\\search.htm"
C# webrowser 控件设置打开页面问题

相关文章:

  • 2021-11-17
  • 2022-02-23
  • 2021-09-01
  • 2022-01-20
  • 2021-12-12
  • 2021-10-07
  • 2022-01-22
  • 2022-12-23
猜你喜欢
  • 2021-05-17
  • 2021-12-29
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案