all groups > dotnet windows forms designtime > january 2005 >
You're in the

dotnet windows forms designtime

group:

IDE-integrated editor



IDE-integrated editor Keith Rome
1/22/2005 12:03:02 PM
dotnet windows forms designtime: I would like to provide a design-time editor for a proprietary file format
within VS.NET. I am shooting for an experience not unlike the SQL Reporting
Services designer (although MUCH less complex).

I can just make a standalone editor utility, but it would be ideal if my
editor could be invoked directly within VS, from the project item that it is
related to (the edited file will always be an embedded resource file).

I would be perfectly happy to just have a default menu option associated
with files of a specific extension in the Solution Explorer, which when
activated would launch a modal dialog where I could edit the contents of my
file.

I have done a lot of poking around in the design namespaces, and the only
thing that seems related to what I want to do is IRootDesigner, which just
sets up a design surface. I cannot find anything that explains where to go
after that, or even how to associate the IRootDesigner with my project
item(s).

Any hints or pointers?

--
Keith Rome
Re: IDE-integrated editor micha NO[at]SPAM nospam.com
1/31/2005 11:18:44 PM
Hey Ho Keith Rome

here is a very basic Sample how to do something like this.
GetView(ViewTechnology.WindowsForms) is the magic Word in the Code.

The rest works like any other Designer.



First Create a Component:

<Designer(GetType(SqlFormRootDesigner), GetType(IRootDesigner))> _
Public Class SqlForm
Inherits Component

End Class

The Create a UserControl. The User Controls is later shown if you open the
File

Public Class SqlFormView
Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

bla bla

End Class


'Then Create the Root Designer for the Component

Public Class SqlFormRootDesigner
Inherits System.Windows.Forms.Design.ComponentDocumentDesigner

Private mComponent As SqlForm
Private mComponentView As SqlFormView
Private mHost As IDesignerHost


Public Overrides Sub Initialize(ByVal component As
System.ComponentModel.IComponent)

MyBase.Initialize(component)
mComponent = component
mComponentView = New SqlFormView
mHost = Me.GetService(GetType(IDesignerHost))
AddHandler mHost.LoadComplete, AddressOf HostLoadComplete

End Sub

Private Sub HostLoadComplete(ByVal sender As Object, ByVal e As
EventArgs)

Dim designContainer As Windows.Forms.Control
Dim rootDes As IRootDesigner

rootDes = Me
designContainer = rootDes.GetView(ViewTechnology.WindowsForms)
mComponentView.Dock = DockStyle.Top
designContainer.Parent.Controls.Add(mComponentView)

End Sub


End Class


Now you can Inherit a Class from "SqlForm"
and the GUI of the UserControl will be shown.



"Keith Rome" <KeithRome@discussions.microsoft.com> schrieb im Newsbeitrag
news:91496D9E-C28A-494A-9174-F74C6DE33461@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button