Page 1 of 1

HTML Forms in Windows Forms

Posted: Tue Feb 23, 2010 1:54 pm
by XZodia
As the names suggests this code library is designed to introduce HTML code (primarily form code) into Windows Forms. It was created because standard Win Form controls use far too many resources when used in large numbers. It also supports web technology's such as Javascript.

http://htmlwinforms.codeplex.com/

To use this library:
  • * Add it to your Toolbox and place the "WebFormViewer" on your form.
    * The WebFormViewer contains a reference to a WebForm, when this is assigned it will automatically load it into view.

    * The library is contained within the "HTMLForms" namespace.
    * To create a WebForm: "WebForm <YourWebForm> = new WebForm();"
    * To add WebControls to the WebForm, use "<YourWebForm>.Controls.Add(<YourWebControl>);"
    * To apply a CSS StyleSheet to the WebForm change "<YourWebForm>.CSSFilename"

    * WebControls are the core of the implementation.
    * Some basic WebControls are included in the library and can be found in the "HTMLForms.Controls" namespace:
    ** Textbox
    ** PasswordBox
    ** TextArea
    ** Checkbox
    ** CheckboxList
    ** ComboBox
    ** ResetButton
    ** Array

Create your own WebControls:
  • * You can create your own WebControl by inheriting from WebControl.

    * You must implement the following methods:
    ** void PopulateRow(); - This is the first routine which will be called, add HtmlElement's to "this.Row" in here. Important: Do Not Store References To The Elements Created.
    ** void Update(); - This is called when the HtmlElement's should be updated to reflect the information in your WebControl. Important: Do Not Add HtmlElement's Here.
    ** object GetData(); - return any relevant data from your WebControl, e.g. Textbox returns the text in the input box as a string.

    * Optional methods:
    ** void AttachEventHandlers(); - If you wish to hook into Events from your HTMLElement's, do this here.
    ** void Link(HtmlElement row); - This is called when the "this.Row" reference needs to be updated and should only be implemented if your WebControl contains other WebControls. Important: Always Call "base.Link(row);"
    ** int RowsUsed { get; } - If your control uses more than one row of its parent table, this should be overridden to return the number of rows used.

    * Properties:
    ** object Tag - Empty object for storing anything associated with the WebControl.
    ** bool Enabled - If false any inputs should be disabled when PopulateRow() or Update() is called.
    ** int RowsUsed - Number of rows of the parent table that this WebControl uses, default 1.
    ** HtmlElement Row - The first row of the WebControls parent table that this WebControl should add information to.
    ** HtmlDocument Document - The HtmlDocument which contains the information provided by this WebControl.
http://htmlwinforms.codeplex.com/

Image

Re: HTML Forms in Windows Forms

Posted: Tue Feb 23, 2010 3:40 pm
by kornman00
WinForms may use a lot of resources in some cases, but at least it doesn't look so...bleh by default lol

Re: HTML Forms in Windows Forms

Posted: Tue Feb 23, 2010 3:52 pm
by neodos
Well if you can use CSS and some images you can make it look pretty badass, this is pretty cool anyway thanks for sharing =)

Re: HTML Forms in Windows Forms

Posted: Tue Feb 23, 2010 4:00 pm
by XZodia
kornman00 wrote:WinForms may use a lot of resources in some cases, but at least it doesn't look so...bleh by default lol
All I can say is, compare this to any meta editor here...

Re: HTML Forms in Windows Forms

Posted: Tue Feb 23, 2010 5:53 pm
by kornman00
Like any program development, that issue can easily be addressed with proper planning and design phases

but this is the halo modding community we're talking about so yeah, I see your point :p