User Control

  • Thread starter Thread starter Greg Oetker
  • Start date Start date
G

Greg Oetker

Hi All,

I'm looking for a good example for writing a User Control that does not
expose the properties of the User Control itself (ie. Tab Stop, Password,
Colors, etc.). I only want to expose the Properties and Methods I created.
Also, I would like to make it invisible at runtime (this.visible = true;
works fine). One last thing is how can I make it go to the bar where all
other non runtime controls (ie. Timer, Menus, Statusbar, etc.) instead of
having it on the application form?

Thanks in advance,
Greg O.
 
Hi Greg,

I would suggest to go with writing a component yourself. According to your
post the component you want to write is not a control on its own.
Unfortunately I dare to say that there is not enough information about how
to write designers. The best article I have found so far is
http://windowsforms.net/articles/shapedesigner.aspx

however check this site you there is more articles that might help you
http://www.windowsforms.net/Articles/default.aspx?PageID=1&Cat=Designer&ModuleFilter=131&tabindex=3
 
Thanks for the input. That looks like where I need to go to find the
answers.

Greg O.

Stoitcho Goutsev (100) said:
Hi Greg,

I would suggest to go with writing a component yourself. According to your
post the component you want to write is not a control on its own.
Unfortunately I dare to say that there is not enough information about how
to write designers. The best article I have found so far is
http://windowsforms.net/articles/shapedesigner.aspx

however check this site you there is more articles that might help you
http://www.windowsforms.net/Articles/default.aspx?PageID=1&Cat=Designer&ModuleFilter=131&tabindex=3


--
HTH
Stoitcho Goutsev (100) [C# MVP]


Greg Oetker said:
Hi All,

I'm looking for a good example for writing a User Control that does not
expose the properties of the User Control itself (ie. Tab Stop, Password,
Colors, etc.). I only want to expose the Properties and Methods I created.
Also, I would like to make it invisible at runtime (this.visible = true;
works fine). One last thing is how can I make it go to the bar where all
other non runtime controls (ie. Timer, Menus, Statusbar, etc.) instead of
having it on the application form?

Thanks in advance,
Greg O.
 
The ultimate answer I was looking for was as follows;

public class MyClass: System.ComponentModel.Component
By using System.ComponentModel.Component that gives be the lowest base of a
control before it starts inheriting properties and methods from the parent
control.

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.UserControl




Greg Oetker said:
Thanks for the input. That looks like where I need to go to find the
answers.

Greg O.

Stoitcho Goutsev (100) said:
Hi Greg,

I would suggest to go with writing a component yourself. According to your
post the component you want to write is not a control on its own.
Unfortunately I dare to say that there is not enough information about how
to write designers. The best article I have found so far is
http://windowsforms.net/articles/shapedesigner.aspx

however check this site you there is more articles that might help you
http://www.windowsforms.net/Articles/default.aspx?PageID=1&Cat=Designer&ModuleFilter=131&tabindex=3
--
HTH
Stoitcho Goutsev (100) [C# MVP]


Greg Oetker said:
Hi All,

I'm looking for a good example for writing a User Control that does not
expose the properties of the User Control itself (ie. Tab Stop, Password,
Colors, etc.). I only want to expose the Properties and Methods I created.
Also, I would like to make it invisible at runtime (this.visible = true;
works fine). One last thing is how can I make it go to the bar where all
other non runtime controls (ie. Timer, Menus, Statusbar, etc.) instead of
having it on the application form?

Thanks in advance,
Greg O.
 
Hi Greg,

To prevent a property to be displayed, use this attribute.

[Browsable(false)]

It will work.

Correct me if i am wrong.
--
Regards,
Chua Wen Ching :)


Greg Oetker said:
The ultimate answer I was looking for was as follows;

public class MyClass: System.ComponentModel.Component
By using System.ComponentModel.Component that gives be the lowest base of a
control before it starts inheriting properties and methods from the parent
control.

System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.UserControl




Greg Oetker said:
Thanks for the input. That looks like where I need to go to find the
answers.

Greg O.

Stoitcho Goutsev (100) said:
Hi Greg,

I would suggest to go with writing a component yourself. According to your
post the component you want to write is not a control on its own.
Unfortunately I dare to say that there is not enough information about how
to write designers. The best article I have found so far is
http://windowsforms.net/articles/shapedesigner.aspx

however check this site you there is more articles that might help you
http://www.windowsforms.net/Articles/default.aspx?PageID=1&Cat=Designer&ModuleFilter=131&tabindex=3
--
HTH
Stoitcho Goutsev (100) [C# MVP]


Hi All,

I'm looking for a good example for writing a User Control that does not
expose the properties of the User Control itself (ie. Tab Stop, Password,
Colors, etc.). I only want to expose the Properties and Methods I created.
Also, I would like to make it invisible at runtime (this.visible = true;
works fine). One last thing is how can I make it go to the bar where all
other non runtime controls (ie. Timer, Menus, Statusbar, etc.) instead of
having it on the application form?

Thanks in advance,
Greg O.
 
Back
Top