Are associated file loactions dynamic?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a problem!

I am using the Task Pane control which MS gave out in their VBPowerPack.

If I add an image to the task frame I have to use a physical path e.g.
c:\connected.bmp as opposed to a more dynamic path such as
System.Environment.CurrentDirectory & "\Images\Connected.bmp".

With a picture box for example I would generally leave it blank and then add
the image at runtime using something like :

image.fromfile(System.Environment.CurrentDirectory & "\Images\Connected.bmp")

thereby allowing the user to have control as to where they can save the
application as the image path is dynamic and the image directory added by the
installer.

I tried editing the VS designer generated code to use a path like the one
above and it works at runtime but I lose the design time view of the image.
It also causes the task frames to render the wrong size being slightly too
short.

Does anyone have any ideas (or better controls) which would help.

P.S. I hope some of that made some sense!
 
Director - Minvent said:
c:\connected.bmp as opposed to a more dynamic path
such as System.Environment.CurrentDirectory & "\Images\Connected.bmp".

Always use 'System.IO.Path.Combine' to combine two paths!
With a picture box for example I would generally leave it
blank and then add the image at runtime using something
like :

image.fromfile(System.Environment.CurrentDirectory &
"\Images\Connected.bmp")

thereby allowing the user to have control as to where they can
save the application as the image path is dynamic and the
image directory added by the installer.

Set the images in your form's constructor directly after the call to
'InitializeComponent'. You can check the form's 'DesignMode' property to
see if the form is in design mode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top