Custom Components and Design time visibility

  • Thread starter Thread starter =?ISO-8859-1?Q?Carlos_Guzm=E1n_=C1lvarez?=
  • Start date Start date
?

=?ISO-8859-1?Q?Carlos_Guzm=E1n_=C1lvarez?=

Hello:

I want to know if it's possible to have a component what
visibility at design time depends on how it's being created,
for example, if the component is manually dropped by the
user to a windows forms it should be displayed but if it's
automatically generated by a Designer, to be assigned to a
property of a different component, it shouldn't.

There are any way of achive this ??



Thanks in advance !!
 
You want a component (thats a reusable thing with no UI) to be visible at design time *on the form*? It should be visible in the component tray but not on the form by default. One of the big steps forwards I think that Winforms made was to differentiate between components and controls (controls are reusable tings with UI) so we didn't get the ridiculas thing like the timer control in VB6 where it takes up part of the UI design surface at deisgn time but has no runtime rendering.

Or have I misunderstood what you want?

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

Hello:

I want to know if it's possible to have a component what
visibility at design time depends on how it's being created,
for example, if the component is manually dropped by the
user to a windows forms it should be displayed but if it's
automatically generated by a Designer, to be assigned to a
property of a different component, it shouldn't.

There are any way of achive this ??
 
Hello:
You want a component (thats a reusable thing with no UI) to be visible at design time *on the form*? It should be visible in the component tray but not on the form by default. One of the big steps forwards I think that Winforms made was to differentiate between components and controls (controls are reusable tings with UI) so we didn't get the ridiculas thing like the timer control in VB6 where it takes up part of the UI design surface at deisgn time but has no runtime rendering.

Or have I misunderstood what you want?

Huummm i need to do something similar to the
System.Data.SqlClient.SqlCommand component,
if you drop a SqlCommand you see at design time
it but if you drop a SqlDataAdapter on a form the
SqlCommand components assigned to the SqlDataAdapter
aren't visible at design time.
 
Carlos,

All you have to do in this case is derive from Component (or
MarshalByValueComponent) and then use that. The reason that the SqlCommands
don't show up is because the adapter will have the reference, so they don't
need to be stored on the class level, they just need to be assigned to
(which is what the designer takes care of).

Hope this helps.
 
Hello:
All you have to do in this case is derive from Component (or
MarshalByValueComponent) and then use that. The reason that the SqlCommands
don't show up is because the adapter will have the reference, so they don't
need to be stored on the class level, they just need to be assigned to
(which is what the designer takes care of).

Thanks for the answer.

Not sure about this, i'm going to try to explait what i want to
do a little better :)

Ok, i'm the author of the Firebird ADO.NET provider and i'm trying to
add Design Time support to the data adapter implementation, i have a
Designer for the Data Adapter classclass, in one method of the Designer
i want to initialize the SelectCommand, InsertCommand, UpdateCommand and
DeleteCommand properties of the data adapter, i'm doing something
like this (in the method handler of one of the designer verbs supported
by the designer):

IDesignerHost host =
(IDesignerHost)this.Component.Site.GetService(typeof(IDesignerHost));

DesignerTransaction transaction =
host.CreateTransaction("GenerateTypeDataSet");

if (((FbDataAdapter)this.Component).SelectCommand == null)
{ ((FbDataAdapter)this.Component).SelectCommand =
host.CreateComponent(typeof(FbCommand)) as FbCommand;
}

transaction.Commit();

Ok with this when i drop a FbDataAdapter into a form the FbCommand
component and i run the designer option that initializes the adapter the
Component assigned to the SelectCommand property is visible at design
time and and i want to hide it.

( The SqlCommand has a DesignTimeVisible property but i'm not sure
what is what it does .... and i f that can be what i need to implement
and how :) )
 
Back
Top