简体   繁体   中英

Re add image resource in Visual Studio 2012

I have a winform project with all button with their icon, now I just "copy" the code and the "image" folder into new project, with folder structure SAME to the old project. But all the icon lost their "source", make the code have hundreds of error like

this.pictureBox1.Image = global::QuanLyKho.Properties.Resources.box;
Error   91  'QuanLyKho.Properties.Resources' does not contain a definition for 'box'    F:\Learning\Working\QuanLyKho\QuanLyKho\Forms\FrmHangHoaList.Designer.cs    521

Is there any "visual" way to re-add all image to Resource so that I don't have to do this programatically?

Experienced the same issue today. And solved it.

Open any form in your project. Open 'BackgroundImage' property of that form. Then import all your images(resources) to the project. Rebuild. Done!!!

NB: You can use any properties where we can import images

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM