Re: path information
- From: "B. Chernick" <BChernick@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 Dec 2005 07:06:02 -0800
Excuse me for jumping in here but are you saying that there is no
straightforward way to access an image already defined within a project?
My problem is this. All I want to do is generate an image from the ImageUrl
of an image button.
Dim tempImage As Image = Image.FromFile(imagebutton1.ImageUrl)
All I get is a FileNotFound exception, even though the image itself displays
normally. The image itself is defined within a folder in the project. The
control Url Type is set to 'Document Relative'. The URL itself is in the
format "../Images/ImageName.bmp" where Images is the project folder.
You would think that such a basic operation would be simple in Dot Net.
"Bob Powell [MVP]" wrote:
> You should really be specifying a path via the registry or from an XML
> config file. Deployment of your application is dependent on the whims of the
> user so you can never guarantee that it will be installed in the same place.
>
> Some may argue that a fixed place such as C:\mydirectory will always be
> apparent but this is not the case because I have seen several systems in
> which the main hard drive was not drive C but some other drive due to the
> now almost ubiquitous multiple memory card readers that are installed today.
> Often the first available free drive letter may be H: or M:
>
> If your code generates an executable then the default file path should be
> the same directory in which the app resides. You can use that to open the
> XML based config file and then read other configuration information from
> there.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
> http://www.ramuseco.com
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Mike" <Mike@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:B2961580-6B52-4A9B-A5B6-DFB573C05485@xxxxxxxxxxxxxxxx
> > Defining an image file like below worked in vb2003:
> > e.Graphics().DrawImage(System.Drawing.Image.FromFile("QC2Invoice.png"),
> > e.Graphics.VisibleClipBounds)
> >
> > "QC2Invoice.png" in ../bin/release
> >
> > Does anyone know how to make reference to files in the release folder when
> > using vb.2005?
> >
> > Thanks...Mike
> >
> >
>
>
>
.
- References:
- Re: path information
- From: Bob Powell [MVP]
- Re: path information
- Prev by Date: Re: Image Processing
- Next by Date: Re: crop with selection
- Previous by thread: Re: path information
- Next by thread: Can't create font anymore
- Index(es):
Relevant Pages
|