HTML Forms in Windows Forms

Post here the finished release of your halo 2 mod project.
Post Reply
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

HTML Forms in Windows Forms

Post 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
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
kornman00
Posts: 104
Joined: Wed Jan 20, 2010 7:48 pm

Re: HTML Forms in Windows Forms

Post by kornman00 »

WinForms may use a lot of resources in some cases, but at least it doesn't look so...bleh by default lol
User avatar
neodos
Posts: 1493
Joined: Sun Dec 09, 2007 8:58 pm

Re: HTML Forms in Windows Forms

Post 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 =)
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: HTML Forms in Windows Forms

Post 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...
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
kornman00
Posts: 104
Joined: Wed Jan 20, 2010 7:48 pm

Re: HTML Forms in Windows Forms

Post 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
Post Reply