Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After changing the class decoration, as I mentioned in my comment, I was able to get the type converter working. With that in hand I was able to use the <a href="http://msdn.microsoft.com/en-us/library/system.drawing.design.uitypeeditor%28v=vs.100%29.aspx" rel="nofollow noreferrer">MSDN article</a> on UITypeEditors to build the dialog I was after.</p> <p>Here's the code (the actual form is handled elsewhere):</p> <pre><code>Public Class FileSelectionEditor Inherits System.Drawing.Design.UITypeEditor Public Sub New() End Sub Public Overloads Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle Return UITypeEditorEditStyle.Modal End Function Public Overloads Overrides Function EditValue(ByVal context As ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object Dim edSvc As IWindowsFormsEditorService = CType(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService) If edSvc Is Nothing Then Return Nothing End If If IsNothing(value) Then Dim file As New BATCORE.Configuration.FileSelection value = file End If Using form As New FileSelectionDialog(value) If edSvc.ShowDialog(form) = DialogResult.OK Then Return form.FileData End If End Using 'If OK was not pressed, return the original value ' Return value End Function End Class </code></pre> <p>Finally, a couple things that tripped me up that are good to know when working with design-time code:</p> <ul> <li>Visual Studio caches the design-time code. In order to get changes made to either the type converter or UITypeEditor I found I had to build the project and then close and reopen the solution.</li> <li>Alt+Enter is the shortcut to open a project's properties. Use it.</li> <li>If you want to use custom types in the settings designer those types must be stored in their own project/DLL.</li> </ul> <p>I know this post is ridiculously long, but hopefully someone will be able to wade through it and use it for their own ends.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload