visual studio designer
-
Hi, I've been trying to get the designer in visual studio to work for a class which isn't derived from "form".. It is a class derived directly from System.. I want the designer to work for my class so I can to drag the database connection from the "server explorer". And have it add all the code automatically to my class as is done for classes derived from "form".. How can I do this?? Your help as always would be greatly appreciated!!
-
Hi, I've been trying to get the designer in visual studio to work for a class which isn't derived from "form".. It is a class derived directly from System.. I want the designer to work for my class so I can to drag the database connection from the "server explorer". And have it add all the code automatically to my class as is done for classes derived from "form".. How can I do this?? Your help as always would be greatly appreciated!!
There was a quick "tip" about just this in one of the recent MSDNTV items. (Go to www.msdn.com/msdntv[^], then look at the archive for the one by Juval Lowy.) Anyway, you temporarily inherit your class from Control (I think), which then enables the designer to do the database work for you. Then you remove the control inheritance if needed. John John
"We want to be alone when we hear too many words and we feel alone when it has been a while since anyone has spoken to us." Paul David Tripp -- War of Words -
There was a quick "tip" about just this in one of the recent MSDNTV items. (Go to www.msdn.com/msdntv[^], then look at the archive for the one by Juval Lowy.) Anyway, you temporarily inherit your class from Control (I think), which then enables the designer to do the database work for you. Then you remove the control inheritance if needed. John John
"We want to be alone when we hear too many words and we feel alone when it has been a while since anyone has spoken to us." Paul David Tripp -- War of WordsI'm doing something similar right now actually... Working on creating a GUI library and engine using DirectX that is designable. You have to implement
IComponent
in your class (deriving fromComponent
is a quick way to do this) because theDesignerHost
(service provided and used by VS.NET) utilizes sites (ISite
), which are the basis of components. Then you have to specify anIRootDesigner
-implementing class in aDesignerAttribute
for youIComponent
class. You can try usingComponentDocumentDesigner
for that if you don't need any custom designer stuff. Also check out an article/sample named ShapeLibrary that gives a nice easy example of utilizing design-time services in .NET. You can find it here: http://windowsforms.net/articles/shapedesigner.aspx[^] Hope this helps...