我的C#应用程序上有一些webBrowsers,实际上我有10. webBrowser0,webBrowser1,webBrowser2等等.
无论如何,我正在执行一个循环来计算每个屏幕以在我拥有的每个屏幕上放置webBrowser,这一切都很容易完成,但在我的循环中,如果有这样的东西.
for (index = 0; index <= totalScreens; index++)
{
if (index == 0)
{
webBrowser0.Width = x;
webBrowser0.Height = x;
}
if (index == 1)
{
webBrowser1.Width = x;
webBrowser1.Height = x;
}
}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我在代码上加倍了,所以如果我可以引用webBrowser {index}那将是完美的但当然不起作用.