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.

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.

HTMLForms Example.PNG

Last edited Feb 23, 2010 at 12:39 PM by xzodia, version 5