Extending a windows form question

7 views
Skip to first unread message

Skinner36

unread,
Nov 11, 2010, 3:14:48 PM11/11/10
to mono-...@googlegroups.com

Hi,

I have just come accross Mono.Addins and I am investigating the framework to
see if we can use it in our applications. The applications will run on
Windows and Mono but all testing is currently on Windows.

I have looked at an example that explains how to create an addin that
extends a menu and toolbar which I understand and which works OK.

I am now trying to extend the main form of the startup application by adding
a user control to it, however, I cannot figure out how to do this at all.

The user control is very simple and only displays a treeview control with no
underlying code.

If someone could tell me how to extend the main form to add a control, or
better still, point me to an example, I would very much appreciate it

Regards,

John,
--
View this message in context: http://mono.1490590.n4.nabble.com/Extending-a-windows-form-question-tp3038482p3038482.html
Sent from the Mono - Addins mailing list archive at Nabble.com.

matteo tesser

unread,
Nov 12, 2010, 6:33:22 AM11/12/10
to mono-...@googlegroups.com
I did something similar for Windows.Forms in the following way. I do
not know if it is the more elegant way to do it but hope it helps:

First define an interface and an extension point for the particular
type of controls I need to extended, In my case it was a toolstrip.

[TypeExtensionPoint("/YourApp/TopToolStrip")]
public interface IToolStrip
{
}

Then in the constructor of yor form, dyamically add the controls that
match the extension. In my case they were toolstrips:

foreach (TypeExtensionNode node in
AddinManager.GetExtensionNodes(""/YourApp/TopToolStrip"))
{
ToolStrip ts = (ToolStrip)node.CreateInstance();
ts.Location = new Point(SX, 0);
SX += ts.Width;

toolStripContainer1.TopToolStripPanel.Controls.Add(ts); //include
the toolstrip
}


probably you can do the same with other types of controls,

Matteo

> --
> You received this message because you are subscribed to the Google Groups "Mono.Addins" group.
> To post to this group, send email to mono-...@googlegroups.com.
> To unsubscribe from this group, send email to mono-addins...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mono-addins?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages