03/07/09 13:43
Linkinf22
Codice sorgente nell' applicazione
private void openFileDialog_FileOk(object sender, CancelEventArgs e)
{
string dllPath = openFileDialog.FileName;
Assembly AggiungiProgramma = Assembly.Load(dllPath);
Type ClasseDelProgrammaDaAggiungere = AggiungiProgramma.GetType"ClasseDelProgramma"
MethodInfo InformazioniMetodo = ClasseDelProgrammaDaAggiungere.GetMethod("AggiungiIlProgramma"
Object Instanza = AggiungiProgramma.CreateInstance(ClasseDelProgrammaDaAggiungere.Name);
InformazioniMetodo.Invoke(Instanza, new Object[] {tabunearth});
}
Codice sorgente della dll... Un po' lunghino
namespace Browser
{
public class ClasseDelProgramma
{
unearth.FrmPrincipale FormPrincipaleUnearth = new FrmPrincipale();
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPrincipale));
this.tabBrowser = new System.Windows.Forms.TabPage();
this.tabPagineWebBrowser = new System.Windows.Forms.TabControl();
this.schedaBrowser = new System.Windows.Forms.TabPage();
this.webBrowser = new System.Windows.Forms.WebBrowser();
this.toolStripBrowser = new System.Windows.Forms.ToolStrip();
this.tsbBrowserIndietro = new System.Windows.Forms.ToolStripButton();
this.tsbBrowserAvanti = new System.Windows.Forms.ToolStripButton();
this.tsbBrowserAddTab = new System.Windows.Forms.ToolStripButton();
this.tsbBrowserRemoveTab = new System.Windows.Forms.ToolStripButton();
this.tsbHome = new System.Windows.Forms.ToolStripButton();
this.tsbImpostazioniBrowser = new System.Windows.Forms.ToolStripButton();
this.btnBrowserVai = new System.Windows.Forms.Button();
this.tbxBrowser = new System.Windows.Forms.TextBox();
this.lblBrowser = new System.Windows.Forms.Label();
this.browserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabBrowser.SuspendLayout();
this.tabPagineWebBrowser.SuspendLayout();
this.schedaBrowser.SuspendLayout();
this.toolStripBrowser.SuspendLayout();
//
// tabBrowser
//
this.tabBrowser.BackColor = System.Drawing.Color.CornflowerBlue;
this.tabBrowser.Controls.Add(this.tabPagineWebBrowser);
this.tabBrowser.Controls.Add(this.toolStripBrowser);
this.tabBrowser.Controls.Add(this.btnBrowserVai);
this.tabBrowser.Controls.Add(this.tbxBrowser);
this.tabBrowser.Controls.Add(this.lblBrowser);
this.tabBrowser.Location = new System.Drawing.Point(4, 22);
this.tabBrowser.Name = "tabBrowser";
this.tabBrowser.Padding = new System.Windows.Forms.Padding(3);
this.tabBrowser.Size = new System.Drawing.Size(768, 521);
this.tabBrowser.TabIndex = 0;
this.tabBrowser.Text = "Browser";
//
// tabPagineWebBrowser
//
this.tabPagineWebBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabPagineWebBrowser.Controls.Add(this.schedaBrowser);
this.tabPagineWebBrowser.Location = new System.Drawing.Point(0, 63);
this.tabPagineWebBrowser.Name = "tabPagineWebBrowser";
this.tabPagineWebBrowser.SelectedIndex = 0;
this.tabPagineWebBrowser.Size = new System.Drawing.Size(772, 462);
this.tabPagineWebBrowser.TabIndex = 5;
//
// schedaBrowser
//
this.schedaBrowser.Controls.Add(this.webBrowser);
this.schedaBrowser.Location = new System.Drawing.Point(4, 22);
this.schedaBrowser.Name = "schedaBrowser";
this.schedaBrowser.Padding = new System.Windows.Forms.Padding(3);
this.schedaBrowser.Size = new System.Drawing.Size(764, 436);
this.schedaBrowser.TabIndex = 0;
this.schedaBrowser.Text = "Scheda vuota";
this.schedaBrowser.UseVisualStyleBackColor = true;
//
// webBrowser
//
this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser.Location = new System.Drawing.Point(3, 3);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
this.webBrowser.Size = new System.Drawing.Size(758, 430);
this.webBrowser.TabIndex = 0;
this.webBrowser.Url = new System.Uri("google.it", System.UriKind.Absolute);
//
// toolStripBrowser
//
this.toolStripBrowser.BackColor = System.Drawing.Color.CornflowerBlue;
this.toolStripBrowser.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStripBrowser.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbBrowserIndietro,
this.tsbBrowserAvanti,
this.tsbBrowserAddTab,
this.tsbBrowserRemoveTab,
this.tsbHome,
this.tsbImpostazioniBrowser});
this.toolStripBrowser.Location = new System.Drawing.Point(3, 3);
this.toolStripBrowser.Name = "toolStripBrowser";
this.toolStripBrowser.Size = new System.Drawing.Size(762, 25);
this.toolStripBrowser.TabIndex = 4;
this.toolStripBrowser.Text = "toolStrip1";
//
// tsbBrowserIndietro
//
this.tsbBrowserIndietro.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserIndietro.ImageTransparentColor = System.Drawing.Color.White;
this.tsbBrowserIndietro.Name = "tsbBrowserIndietro";
this.tsbBrowserIndietro.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserIndietro.Text = "Indietro";
//
// tsbBrowserAvanti
//
this.tsbBrowserAvanti.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserAvanti.ImageTransparentColor = System.Drawing.Color.White;
this.tsbBrowserAvanti.Name = "tsbBrowserAvanti";
this.tsbBrowserAvanti.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserAvanti.Text = "Avanti";
//
// tsbBrowserAddTab
//
this.tsbBrowserAddTab.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserAddTab.Image = ((System.Drawing.Image)(resources.GetObject("tsbBrowserAddTab.Image"));
this.tsbBrowserAddTab.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbBrowserAddTab.Name = "tsbBrowserAddTab";
this.tsbBrowserAddTab.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserAddTab.Text = "+";
//
// tsbBrowserRemoveTab
//
this.tsbBrowserRemoveTab.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserRemoveTab.Image = ((System.Drawing.Image)(resources.GetObject("tsbBrowserRemoveTab.Image"));
this.tsbBrowserRemoveTab.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbBrowserRemoveTab.Name = "tsbBrowserRemoveTab";
this.tsbBrowserRemoveTab.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserRemoveTab.Text = "-";
//
// tsbHome
//
this.tsbHome.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbHome.Image = ((System.Drawing.Image)(resources.GetObject("tsbHome.Image"));
this.tsbHome.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbHome.Name = "tsbHome";
this.tsbHome.Size = new System.Drawing.Size(44, 22);
this.tsbHome.Text = "Home";
//
// tsbImpostazioniBrowser
//
this.tsbImpostazioniBrowser.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbImpostazioniBrowser.Image = ((System.Drawing.Image)(resources.GetObject("tsbImpostazioniBrowser.Image"));
this.tsbImpostazioniBrowser.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbImpostazioniBrowser.Name = "tsbImpostazioniBrowser";
this.tsbImpostazioniBrowser.Size = new System.Drawing.Size(79, 22);
this.tsbImpostazioniBrowser.Text = "Impostazioni";
//
// btnBrowserVai
//
this.btnBrowserVai.Location = new System.Drawing.Point(287, 34);
this.btnBrowserVai.Name = "btnBrowserVai";
this.btnBrowserVai.Size = new System.Drawing.Size(40, 23);
this.btnBrowserVai.TabIndex = 3;
this.btnBrowserVai.Text = "Vai";
this.btnBrowserVai.UseVisualStyleBackColor = true;
//
// tbxBrowser
//
this.tbxBrowser.Location = new System.Drawing.Point(55, 34);
this.tbxBrowser.Name = "tbxBrowser";
this.tbxBrowser.Size = new System.Drawing.Size(226, 20);
this.tbxBrowser.TabIndex = 2;
//
// lblBrowser
//
this.lblBrowser.AutoSize = true;
this.lblBrowser.BackColor = System.Drawing.Color.Transparent;
this.lblBrowser.Location = new System.Drawing.Point(1, 37);
this.lblBrowser.Name = "lblBrowser";
this.lblBrowser.Size = new System.Drawing.Size(48, 13);
this.lblBrowser.TabIndex = 1;
this.lblBrowser.Text = "Indirizzo:";
}
private void AggiungiIlProgramma(TabControl tabunearth)
{
FormPrincipaleUnearth.tabunearth.TabPages.Add(tabBrowser);
}
private System.Windows.Forms.TabPage tabBrowser;
private System.Windows.Forms.Label lblBrowser;
private System.Windows.Forms.Button btnBrowserVai;
private System.Windows.Forms.TextBox tbxBrowser;
private System.Windows.Forms.ToolStrip toolStripBrowser;
private System.Windows.Forms.TabControl tabPagineWebBrowser;
private System.Windows.Forms.TabPage schedaBrowser;
public System.Windows.Forms.WebBrowser webBrowser;
private System.Windows.Forms.ToolStripButton tsbHome;
private System.Windows.Forms.ToolStripButton tsbBrowserIndietro;
private System.Windows.Forms.ToolStripButton tsbBrowserAvanti;
private System.Windows.Forms.ToolStripButton tsbBrowserAddTab;
private System.Windows.Forms.ToolStripButton tsbImpostazioniBrowser;
private System.Windows.Forms.ToolStripButton tsbBrowserRemoveTab;
private System.Windows.Forms.ToolStripMenuItem browserToolStripMenuItem;
}
}
private void openFileDialog_FileOk(object sender, CancelEventArgs e)
{
string dllPath = openFileDialog.FileName;
Assembly AggiungiProgramma = Assembly.Load(dllPath);
Type ClasseDelProgrammaDaAggiungere = AggiungiProgramma.GetType"ClasseDelProgramma"
MethodInfo InformazioniMetodo = ClasseDelProgrammaDaAggiungere.GetMethod("AggiungiIlProgramma"
Object Instanza = AggiungiProgramma.CreateInstance(ClasseDelProgrammaDaAggiungere.Name);
InformazioniMetodo.Invoke(Instanza, new Object[] {tabunearth});
}
Codice sorgente della dll... Un po' lunghino
namespace Browser
{
public class ClasseDelProgramma
{
unearth.FrmPrincipale FormPrincipaleUnearth = new FrmPrincipale();
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPrincipale));
this.tabBrowser = new System.Windows.Forms.TabPage();
this.tabPagineWebBrowser = new System.Windows.Forms.TabControl();
this.schedaBrowser = new System.Windows.Forms.TabPage();
this.webBrowser = new System.Windows.Forms.WebBrowser();
this.toolStripBrowser = new System.Windows.Forms.ToolStrip();
this.tsbBrowserIndietro = new System.Windows.Forms.ToolStripButton();
this.tsbBrowserAvanti = new System.Windows.Forms.ToolStripButton();
this.tsbBrowserAddTab = new System.Windows.Forms.ToolStripButton();
this.tsbBrowserRemoveTab = new System.Windows.Forms.ToolStripButton();
this.tsbHome = new System.Windows.Forms.ToolStripButton();
this.tsbImpostazioniBrowser = new System.Windows.Forms.ToolStripButton();
this.btnBrowserVai = new System.Windows.Forms.Button();
this.tbxBrowser = new System.Windows.Forms.TextBox();
this.lblBrowser = new System.Windows.Forms.Label();
this.browserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabBrowser.SuspendLayout();
this.tabPagineWebBrowser.SuspendLayout();
this.schedaBrowser.SuspendLayout();
this.toolStripBrowser.SuspendLayout();
//
// tabBrowser
//
this.tabBrowser.BackColor = System.Drawing.Color.CornflowerBlue;
this.tabBrowser.Controls.Add(this.tabPagineWebBrowser);
this.tabBrowser.Controls.Add(this.toolStripBrowser);
this.tabBrowser.Controls.Add(this.btnBrowserVai);
this.tabBrowser.Controls.Add(this.tbxBrowser);
this.tabBrowser.Controls.Add(this.lblBrowser);
this.tabBrowser.Location = new System.Drawing.Point(4, 22);
this.tabBrowser.Name = "tabBrowser";
this.tabBrowser.Padding = new System.Windows.Forms.Padding(3);
this.tabBrowser.Size = new System.Drawing.Size(768, 521);
this.tabBrowser.TabIndex = 0;
this.tabBrowser.Text = "Browser";
//
// tabPagineWebBrowser
//
this.tabPagineWebBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabPagineWebBrowser.Controls.Add(this.schedaBrowser);
this.tabPagineWebBrowser.Location = new System.Drawing.Point(0, 63);
this.tabPagineWebBrowser.Name = "tabPagineWebBrowser";
this.tabPagineWebBrowser.SelectedIndex = 0;
this.tabPagineWebBrowser.Size = new System.Drawing.Size(772, 462);
this.tabPagineWebBrowser.TabIndex = 5;
//
// schedaBrowser
//
this.schedaBrowser.Controls.Add(this.webBrowser);
this.schedaBrowser.Location = new System.Drawing.Point(4, 22);
this.schedaBrowser.Name = "schedaBrowser";
this.schedaBrowser.Padding = new System.Windows.Forms.Padding(3);
this.schedaBrowser.Size = new System.Drawing.Size(764, 436);
this.schedaBrowser.TabIndex = 0;
this.schedaBrowser.Text = "Scheda vuota";
this.schedaBrowser.UseVisualStyleBackColor = true;
//
// webBrowser
//
this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser.Location = new System.Drawing.Point(3, 3);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
this.webBrowser.Size = new System.Drawing.Size(758, 430);
this.webBrowser.TabIndex = 0;
this.webBrowser.Url = new System.Uri("google.it", System.UriKind.Absolute);
//
// toolStripBrowser
//
this.toolStripBrowser.BackColor = System.Drawing.Color.CornflowerBlue;
this.toolStripBrowser.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStripBrowser.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbBrowserIndietro,
this.tsbBrowserAvanti,
this.tsbBrowserAddTab,
this.tsbBrowserRemoveTab,
this.tsbHome,
this.tsbImpostazioniBrowser});
this.toolStripBrowser.Location = new System.Drawing.Point(3, 3);
this.toolStripBrowser.Name = "toolStripBrowser";
this.toolStripBrowser.Size = new System.Drawing.Size(762, 25);
this.toolStripBrowser.TabIndex = 4;
this.toolStripBrowser.Text = "toolStrip1";
//
// tsbBrowserIndietro
//
this.tsbBrowserIndietro.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserIndietro.ImageTransparentColor = System.Drawing.Color.White;
this.tsbBrowserIndietro.Name = "tsbBrowserIndietro";
this.tsbBrowserIndietro.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserIndietro.Text = "Indietro";
//
// tsbBrowserAvanti
//
this.tsbBrowserAvanti.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserAvanti.ImageTransparentColor = System.Drawing.Color.White;
this.tsbBrowserAvanti.Name = "tsbBrowserAvanti";
this.tsbBrowserAvanti.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserAvanti.Text = "Avanti";
//
// tsbBrowserAddTab
//
this.tsbBrowserAddTab.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserAddTab.Image = ((System.Drawing.Image)(resources.GetObject("tsbBrowserAddTab.Image"));
this.tsbBrowserAddTab.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbBrowserAddTab.Name = "tsbBrowserAddTab";
this.tsbBrowserAddTab.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserAddTab.Text = "+";
//
// tsbBrowserRemoveTab
//
this.tsbBrowserRemoveTab.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbBrowserRemoveTab.Image = ((System.Drawing.Image)(resources.GetObject("tsbBrowserRemoveTab.Image"));
this.tsbBrowserRemoveTab.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbBrowserRemoveTab.Name = "tsbBrowserRemoveTab";
this.tsbBrowserRemoveTab.Size = new System.Drawing.Size(23, 22);
this.tsbBrowserRemoveTab.Text = "-";
//
// tsbHome
//
this.tsbHome.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbHome.Image = ((System.Drawing.Image)(resources.GetObject("tsbHome.Image"));
this.tsbHome.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbHome.Name = "tsbHome";
this.tsbHome.Size = new System.Drawing.Size(44, 22);
this.tsbHome.Text = "Home";
//
// tsbImpostazioniBrowser
//
this.tsbImpostazioniBrowser.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbImpostazioniBrowser.Image = ((System.Drawing.Image)(resources.GetObject("tsbImpostazioniBrowser.Image"));
this.tsbImpostazioniBrowser.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbImpostazioniBrowser.Name = "tsbImpostazioniBrowser";
this.tsbImpostazioniBrowser.Size = new System.Drawing.Size(79, 22);
this.tsbImpostazioniBrowser.Text = "Impostazioni";
//
// btnBrowserVai
//
this.btnBrowserVai.Location = new System.Drawing.Point(287, 34);
this.btnBrowserVai.Name = "btnBrowserVai";
this.btnBrowserVai.Size = new System.Drawing.Size(40, 23);
this.btnBrowserVai.TabIndex = 3;
this.btnBrowserVai.Text = "Vai";
this.btnBrowserVai.UseVisualStyleBackColor = true;
//
// tbxBrowser
//
this.tbxBrowser.Location = new System.Drawing.Point(55, 34);
this.tbxBrowser.Name = "tbxBrowser";
this.tbxBrowser.Size = new System.Drawing.Size(226, 20);
this.tbxBrowser.TabIndex = 2;
//
// lblBrowser
//
this.lblBrowser.AutoSize = true;
this.lblBrowser.BackColor = System.Drawing.Color.Transparent;
this.lblBrowser.Location = new System.Drawing.Point(1, 37);
this.lblBrowser.Name = "lblBrowser";
this.lblBrowser.Size = new System.Drawing.Size(48, 13);
this.lblBrowser.TabIndex = 1;
this.lblBrowser.Text = "Indirizzo:";
}
private void AggiungiIlProgramma(TabControl tabunearth)
{
FormPrincipaleUnearth.tabunearth.TabPages.Add(tabBrowser);
}
private System.Windows.Forms.TabPage tabBrowser;
private System.Windows.Forms.Label lblBrowser;
private System.Windows.Forms.Button btnBrowserVai;
private System.Windows.Forms.TextBox tbxBrowser;
private System.Windows.Forms.ToolStrip toolStripBrowser;
private System.Windows.Forms.TabControl tabPagineWebBrowser;
private System.Windows.Forms.TabPage schedaBrowser;
public System.Windows.Forms.WebBrowser webBrowser;
private System.Windows.Forms.ToolStripButton tsbHome;
private System.Windows.Forms.ToolStripButton tsbBrowserIndietro;
private System.Windows.Forms.ToolStripButton tsbBrowserAvanti;
private System.Windows.Forms.ToolStripButton tsbBrowserAddTab;
private System.Windows.Forms.ToolStripButton tsbImpostazioniBrowser;
private System.Windows.Forms.ToolStripButton tsbBrowserRemoveTab;
private System.Windows.Forms.ToolStripMenuItem browserToolStripMenuItem;
}
}
aaa