|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to code image path relative to projectrelative to my project. I need the image to be a file so that it can be processed by the "DrawImageToScale" function so that the image is reduced in size to a panel on the form. Dim img As Image = Image.FromFile("C:\Project\HumanServices\HumanServices\image\Contact.jpg") Call DrawImageToScale(picModule1, img) If this is not possible, is there a way to convert an embedded Resource into a File or Stream? Thanks, Dean S is
Image.FromFile(Application.StartupPath & "\Image\contact.jpg") what your looking for? -- -iwdu15 "iwdu15" <jmmgoalsteratyahoodotcom> schrieb: It's better to use 'Path.Combine' to concatenate the path with the file name > Image.FromFile(Application.StartupPath & "\Image\contact.jpg") > > what your looking for? to prevent problems arising when the program is installed into the root directory of the drive which may cause double backslashes to appear in the combined path. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried,
Thank I will pay attention to that in future Cor Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:OuZROjMvGHA.4688@TK2MSFTNGP06.phx.gbl... > "iwdu15" <jmmgoalsteratyahoodotcom> schrieb: >> Image.FromFile(Application.StartupPath & "\Image\contact.jpg") >> >> what your looking for? > > It's better to use 'Path.Combine' to concatenate the path with the file > name to prevent problems arising when the program is installed into the > root directory of the drive which may cause double backslashes to appear > in the combined path. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/>
Show quote
Hide quote
"Dean Slindee" <slin***@charter.net> wrote in message To get the embedded resource as a stream, you use Reflection. Look up the news:38KCg.281$NU3.35@newsfe04.lga... > In order to deploy my app, I need to specify the following file path as > relative to my project. I need the image to be a file so that it can be > processed by the "DrawImageToScale" function so that the image is reduced > in size to a panel on the form. > > > Dim img As Image = > Image.FromFile("C:\Project\HumanServices\HumanServices\image\Contact.jpg") > > Call DrawImageToScale(picModule1, img) > > If this is not possible, is there a way to convert an embedded Resource > into a File or Stream? > > > > Thanks, > > Dean S > > > > > > GetManifestResourceStream method on the Assembly class :) HTH, Mythran |
|||||||||||||||||||||||