我正在尝试将随机图像分配给面板:
System.Random randomNum = new System.Random();
int myInt = randomNum.Next(4);
if (Panel1.BackgroundImage != null)
{
switch (myInt)
{
case 0:
Panel1.BackgroundImage = @"C:\Users\etrit.bujupi\Desktop\IO-Etrit\CardGame\Images\2-Black.jpg";
}
}
但是我的代码会导致错误:
无法将类型“字符串”隐式转换为“System.Drawing.Image”