المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Design-Time Error in the Windows Forms Designer



C# Programming
01-18-2013, 11:31 PM
I have 1 Usercontrol. In it I load an image from code. But when I go to Form1 and put this control into form, I get an error that he can not find the image, but the image is there, and the root is correct from code. When I run the application, is working fine, loading the correct image. What setting I miss?
Thanks and here is the code:
public partial class Equipment : UserControl { public Equipment(){InitializeComponent();} string path = Application.StartupPath; PictureBox pictureBox3429= new PictureBox(); public void Equipment_Load(object sender, EventArgs e) { panel1.BackgroundImage = Image.FromFile(path + "\\unit.jpg"); try { //second variant, same problem: //pictureBox3429.Load(path + "\\mechhero.com\\unit.jpg"); //panel1.BackgroundImage = pictureBox3429.Image; } catch (Exception) { throw; } } }