home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Support
General Support
Web Browser Plugin
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="reagan+carter" data-source="post: 125211" data-attributes="member: 24635"><p>hello dalanorth,</p><p></p><p>i had used (to some extents) the Internet Explorer webcontrol and needed this kind of feature (i.e. skin dependent resizing). This control was pretty nasty to correctly embed in a MediaPortal UI. A quick workaround I've tried was to stretch the control the size of a dummy MediaPortal GUIControl which, in turn, could be easily resized using skin XML entries.</p><p></p><p>[CODE]</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Text;</p><p>using System.Windows.Forms;</p><p>using MediaPortal.GUI.Library;</p><p></p><p>namespace MediaPortal.Messaging.Core</p><p></p><p>{</p><p></p><p> /// <summary></p><p> /// Simple webbrowser wrapper.</p><p> /// </summary></p><p></p><p> public class GUIHTMLReader : GUIControl</p><p></p><p> {</p><p></p><p> WebBrowser HTMLReader;</p><p></p><p> public String Document</p><p> {</p><p> get { return HTMLReader.DocumentText; }</p><p> set { HTMLReader.DocumentText = value; }</p><p> }</p><p></p><p> public GUIHTMLReader(int dwParentID)</p><p> : base(dwParentID)</p><p> {</p><p> }</p><p></p><p> public GUIHTMLReader(int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight)</p><p> : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight)</p><p> {</p><p> }</p><p></p><p> public override void AllocResources()</p><p> {</p><p></p><p> base.AllocResources();</p><p></p><p> Log.Debug("GUIHTMLReader : AllocResources");</p><p></p><p> //Create the actual generic container</p><p> HTMLReader = new System.Windows.Forms.WebBrowser();</p><p> HTMLReader.SetBounds(XPosition, YPosition, Width, Height);</p><p> InitWebComponentOptions();</p><p></p><p> this.IsVisible = false;</p><p></p><p> GUIGraphicsContext.form.Controls.Add(HTMLReader);</p><p> }</p><p></p><p> void InitWebComponentOptions()</p><p> {</p><p> HTMLReader.AllowNavigation = false;</p><p> HTMLReader.AllowWebBrowserDrop = false;</p><p> HTMLReader.ScriptErrorsSuppressed = true;</p><p> HTMLReader.WebBrowserShortcutsEnabled = false;</p><p> HTMLReader.ScrollBarsEnabled = true;</p><p> }</p><p></p><p> public override void FreeResources()</p><p> {</p><p> base.FreeResources();</p><p></p><p> Log.Debug("GUIHTMLReader : Dispose");</p><p></p><p> HTMLReader.Dispose();</p><p> }</p><p></p><p> public override bool IsVisible</p><p> {</p><p> get</p><p> {</p><p> return base.IsVisible;</p><p> }</p><p> set</p><p> {</p><p> base.IsVisible = value;</p><p> if (value)</p><p> HTMLReader.Show(); </p><p> else</p><p> HTMLReader.Hide();</p><p> }</p><p> }</p><p></p><p> }</p><p></p><p>}</p><p>[/CODE]</p><p></p><p>+ in the Init() procedure of the plugin:</p><p></p><p> [CODE]</p><p> //Pre-register the simplecontainer control class so that the factory knows how to create it</p><p> //It will be used as a container for the webbrowser component</p><p> GUIControlFactory.RegisterControl("htmlreader", typeof(GUIHTMLReader));</p><p> //Then load the GUI using the XML skin file</p><p> bool bResult = Load(GUIGraphicsContext.Skin + @"\mymessage.xml");</p><p>[/CODE]</p><p></p><p>Then in the skin XML the webcontrol size could be specified and tweaked by skinners:</p><p></p><p>[CODE]</p><p><control></p><p><description>HTML frame area</description></p><p><type>htmlreader</type></p><p><id>52</id></p><p><posX>260</posX></p><p><posY>222</posY></p><p><width>410</width></p><p><height>300</height></p><p></control></p><p>[/CODE]</p><p></p><p>maybe this could be of any help</p></blockquote><p></p>
[QUOTE="reagan+carter, post: 125211, member: 24635"] hello dalanorth, i had used (to some extents) the Internet Explorer webcontrol and needed this kind of feature (i.e. skin dependent resizing). This control was pretty nasty to correctly embed in a MediaPortal UI. A quick workaround I've tried was to stretch the control the size of a dummy MediaPortal GUIControl which, in turn, could be easily resized using skin XML entries. [CODE] using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using MediaPortal.GUI.Library; namespace MediaPortal.Messaging.Core { /// <summary> /// Simple webbrowser wrapper. /// </summary> public class GUIHTMLReader : GUIControl { WebBrowser HTMLReader; public String Document { get { return HTMLReader.DocumentText; } set { HTMLReader.DocumentText = value; } } public GUIHTMLReader(int dwParentID) : base(dwParentID) { } public GUIHTMLReader(int dwParentID, int dwControlId, int dwPosX, int dwPosY, int dwWidth, int dwHeight) : base(dwParentID, dwControlId, dwPosX, dwPosY, dwWidth, dwHeight) { } public override void AllocResources() { base.AllocResources(); Log.Debug("GUIHTMLReader : AllocResources"); //Create the actual generic container HTMLReader = new System.Windows.Forms.WebBrowser(); HTMLReader.SetBounds(XPosition, YPosition, Width, Height); InitWebComponentOptions(); this.IsVisible = false; GUIGraphicsContext.form.Controls.Add(HTMLReader); } void InitWebComponentOptions() { HTMLReader.AllowNavigation = false; HTMLReader.AllowWebBrowserDrop = false; HTMLReader.ScriptErrorsSuppressed = true; HTMLReader.WebBrowserShortcutsEnabled = false; HTMLReader.ScrollBarsEnabled = true; } public override void FreeResources() { base.FreeResources(); Log.Debug("GUIHTMLReader : Dispose"); HTMLReader.Dispose(); } public override bool IsVisible { get { return base.IsVisible; } set { base.IsVisible = value; if (value) HTMLReader.Show(); else HTMLReader.Hide(); } } } } [/CODE] + in the Init() procedure of the plugin: [CODE] //Pre-register the simplecontainer control class so that the factory knows how to create it //It will be used as a container for the webbrowser component GUIControlFactory.RegisterControl("htmlreader", typeof(GUIHTMLReader)); //Then load the GUI using the XML skin file bool bResult = Load(GUIGraphicsContext.Skin + @"\mymessage.xml"); [/CODE] Then in the skin XML the webcontrol size could be specified and tweaked by skinners: [CODE] <control> <description>HTML frame area</description> <type>htmlreader</type> <id>52</id> <posX>260</posX> <posY>222</posY> <width>410</width> <height>300</height> </control> [/CODE] maybe this could be of any help [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
General Support
Web Browser Plugin
Contact us
RSS
Top
Bottom