This content has been marked as final. Show 1 reply
You can place as many user controls on a gadget as you like. It's merely a matter of how much screen size you take up overall. The gadgets are resizable. So, you can use the entire displayable area, if that's what you need.
The gadgets are WinForm-based UserControl objects themselves. Any WinForm based-controls can be used, including browser containers (WebBrowser control) for web / HTML content.
I'm not sure how you are placing the user controls on the gadget panel / form. So, it's difficult to say what the problem is.
One way to switch the UI display is to place a TabControl on the gadget and then place the individual user controls each into a separate tab of the TabControl. You can programmatically switch which tab is visible.
Another more straight forward route would be to Add & Remove your UserControls to & from the gadget's "Controls" collection, programmatically switching which user control is displayed within the gadget's UI area. By this route you can remove one control and add the other control. Just keep a live reference of both controls to prevent them from going out of scope and being garbage collected, when removed from the Controls collection.
Again, without discussing or seeing your code directly, it's difficult to determine the exact problem you are having. One way to switch UserControls in the gadget is provided below in C#. The VB code would be about the same. In this case two Controls are both programmatically placed into the gadget UI and switched into and out of visibility by adding one to & removing the other from the gadget's "Controls" collection.
public sealed partial class Gadget1Gadget : BaseGadget
private System.Windows.Forms.WebBrowser webBrowser1 = null;
private System.Windows.Forms.WebBrowser webBrowser2 = null;
public override void Init()
// CREATE THE FIRST USER CONTROL & DISPLAY IT webBrowser1
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.webBrowser1.Location = new System.Drawing.Point(15, 22);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(389, 192);
this.webBrowser1.TabIndex = 0;
/// ADD TO THE GADGET'S UI CONTROLS COLLECTION
/// CREATE USER CONTROL 2 (webBrowser2), FOR LATER USE
this.webBrowser2 = new System.Windows.Forms.WebBrowser();
private void button1_Click(object sender, System.EventArgs e)
/// REMOVE THE FIRST USER CONTROL FROM THE UI
/// ADD THE SECOND USER CONTROL TO THE UI
this.webBrowser2.Location = new System.Drawing.Point(16, 13);
this.webBrowser2.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser2.Name = "webBrowser2";
this.webBrowser2.Size = new System.Drawing.Size(250, 135);