How to know how control is placed on a form

  • Thread starter Thread starter Andrea Moro
  • Start date Start date
A

Andrea Moro

Control may be added on a form by double-clicking
it on the toolbox, or selecting it and then drawing on
the form.

Is there a parameter, a variable, a message that let
me say how control has been painter - before the
oncreatecontrol method?
 
Ken

it isn't what I'm looking for. I see for this property before
post, but there is any returned parameter, or casting option
that let me know in which way control is placed (designed
or dragged/double clicked).

Andrea
 
it isn't what I'm looking for. I see for this property before
post, but there is any returned parameter, or casting option
that let me know in which way control is placed (designed
or dragged/double clicked).

I'm curious: why do you need to know?
 
I'm curious: why do you need to know?

Well Jeff,

maybe that I'm missing something that may be solved
in another way, but actually I don't think to anything
else.

I would like to setup a defaultsize to the control when
it's posizioned by dragging or by double cliccking on the
toolbox.

I hoped that defaultsize property might be usefull, but
it's is readonly and not overridable. So I cannot set a minimu
control size and value proposed by framework is too much wide.

Isn't there any other way to set up it?

Andrea
 
Andrea Moro said:
I would like to setup a defaultsize to the control when
it's posizioned by dragging or by double cliccking on the
toolbox.

One way is to use your own designer, which inherits from the control's
original designer. In it, you would place something like this:

Public Overloads Overrides Sub OnSetComponentDefaults()
MyBase.OnSetComponentDefaults()
MyBase.Control.Size = New Size(496, 312) ' whatever your desired
default size is
End Sub

Best Regards,

Andy
 
Andy thanks.
I don't tried it, but it sounds like what I'm looking for.
I searched for it a lot of time, but one of the main problem
of the ide - IMHO - is that doesn't show all possible
overloadable subs/functions.
This mean a lot of wasted time to search possibile routine
that can help us.

I think that MS - in the next version of Ide - should add
all overiddable routine inherited from all classes from
within a class depends.

Andrea
 
Andy

I'm not able to overloads the OnSetComponentDefaults.
Framework is saying that those method isn't a part of the
base class.

I'm inheriting from usercontrol.

I taked a look to the object browser, and serching for it,
it doesn't display anything. If I setup a reference for system.design
assembly for the working project, I can see it, but always I
don't know how to use it.

Can you help me again?

I'm doing a lot of confuision with assembly, namespaces etc.

Andrea


System.ComponentModel.Design > ComponentDesigner Class
seems doesn't exist on my pc.
 
Andrea Moro said:
I'm not able to overloads the OnSetComponentDefaults.
Framework is saying that those method isn't a part of the
base class.

I'm inheriting from usercontrol.

Your control will need to use its own designer, and that designer class is
where OnSetComponentDefaults goes. Check out
System.ComponentModel.DesignerAttribute in the help.

Best Regards,

Andy
 

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

Back
Top