Re: path information

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
> >
> >
>
>
>
.



Relevant Pages

  • Re: Custom Zoom & Performance
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... the scaled pixel ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Printing graphics/text that span multiple pages
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... You need to figure out how many pages you need and then render your ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Hotspots in graphic
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > What is the best way to draw that image on the screen? ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Hotspots in graphic
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > What is the best way to draw that image on the screen? ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Drawing backgeound image slows down form performance
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > I have a windows form application that draws the background with a color ...
    (microsoft.public.dotnet.framework.drawing)