Design time relative URLS like ImageURL

  • Thread starter Justin Weinberg
  • Start date
J

Justin Weinberg

I've googled and saw this question posted a lot, and saw an answer that
involved using EnvDTE, but I suspect there must be an easier way.

If I have a property on a control (inheriting from webcontrol) how can I get
a path to a file specified in a URL relative to the root directory. It has
to be possible because the Image control must do just that in order to
render a preview of the image in the designer (from the relative URL
specified in the ImageURL property)

This is pretty much the last stumbling block I have on finishing this
control.

Many thanks in advance. I spent the better part of today trying to find a
solution.
 
A

Alessandro Zifiglio

hi ;)
YOu will have to associate an editor to your property. The editor you want
is the ImageUrlEditor. It Provides a user interface for selecting a URL to
an image.

Private _NavigateURL as string
<Bindable(False), Category("Appearance"), _
DefaultValue("/Images/someimage.jpg"), _
Description("Locate your image"), _
Editor(GetType(System.Web.UI.Design.ImageUrlEditor),
GetType(System.Drawing.Design.UITypeEditor))> _
Property [NavigateURL]() As String
Get
Return _NavigateURL
End Get

Set(ByVal Value As String)
_NavigateURL = Value
End Set
End Property

Look in the docs under : ImageUrlEditor, this class is described there.

Alessandro
 
I

IgorW

Justin said:
I've googled and saw this question posted a lot, and saw an answer that
involved using EnvDTE, but I suspect there must be an easier way.

If I have a property on a control (inheriting from webcontrol) how can I get
a path to a file specified in a URL relative to the root directory. It has
to be possible because the Image control must do just that in order to
render a preview of the image in the designer (from the relative URL
specified in the ImageURL property)

This is pretty much the last stumbling block I have on finishing this
control.

Many thanks in advance. I spent the better part of today trying to find a
solution.
Hi Justin,

I have a question about EnvDTE: How can I access the DTE in a
ControlDesigner? have you any information about?

thanks

IgorW
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top