c# - Application cannot locate resource file in Visual Studio 2010 designer -


i made custom user control contains picturebox, renders png image resource folder:

private void picturebox1_paint(object sender, painteventargs e) {     //overlay shape of     image transparentimg = image.fromfile("..\\..\\resources\\reservoir_img.png");     e.graphics.drawimage(transparentimg, new point(0, 0));   } 

when build , run application user control paint method renders png fine (path must right), when preview form designer in visual studio 2010 doesn't render. shows exception:

filenotfoundexception

i can develop , test application, it's kind of annoying design forms when see exception texts.

solution use resources.resx file:

e.graphics.drawimage(windowsformsapplication1.properties.resources.reservoir_img, new point(0, 0)); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -