Introduction
XHTMLDesigner is a designer than can design web-form , unlike mostly web-form designer ( eg. VS.NET's web-form designer ) which depend on System.Web.UI , this designer own draw design view by GDI+ . Using GDI+ , it draw vector shape which like web-form control , include input-text , input-radio , input-checkbox , textarea , select . This designer use absolute coordinate , but it can create very simple html document which use flow layout , and the design view is very near with design view , this designer can transform those two coordinate . XHTMLDesigner can save design result to a XML file , or load document from a XML file . In fact , XHTMLDesigner is a application of XDesignerLib .
Using the code
XHTMLDesigner is a application of XDesignerLib , XDesignerLib is a middle ware which use to create WYSWYG designer easy and fast . XDesignerLib already bring a set of design DOOM , people can extend design DOM to create own designer . For example , in XHTMLDesigner , it create a button element by the following C# code :
using System;
using XDesignerDom ;
using XDesignerDom.ControlBase ;
namespace XDesigner.HtmlForm
{
public class DesignHtmlButton : DesignButtonBase
{
public override bool SaveProperties
(XDesignerProperty.IPropertyPackage Saver)
{
base.WriteBounds( Saver );
Saver.SetString("id" , strID );
Saver.SetString("name" , strName );
Saver.SetString( "classname" , strClassName );
Saver.SetColor( "textcolor" , this.intTextColor ,
System.Drawing.SystemColors.ControlText );
Saver.SetColor( "backcolor" , this.intBackColor ,
System.Drawing.SystemColors.Control );
Saver.SetString( "text" , strText );
Saver.SetString("onclickcontent" , strOnClickContent );
Saver.SetString("value" , strValue );
Saver.SetFont( "font" , myFont , myOwnerDocument.DefaultFont );
Saver.SetBoolean("enable" , bolEnable , true );
return true;
}
public override bool LoadProperties
(XDesignerProperty.IPropertyPackage Loader)
{
base.ReadBounds( Loader );
strID = Loader.GetString("id");
strName = Loader.GetString("name");
strText = Loader.GetString("text");
strClassName = Loader.GetString("classname");
intTextColor = Loader.GetColor("textcolor" ,
System.Drawing.SystemColors.ControlText );
intBackColor = Loader.GetColor("backcolor" ,
System.Drawing.SystemColors.Control );
strValue = Loader.GetString("value");
myFont = Loader.GetFont("font" , myOwnerDocument.DefaultFont );
strOnClickContent = Loader.GetString("onclickcontent");
bolEnable = Loader.GetBoolean( "enable" , true);
return true;
}
protected string strName = null;
public string Name
{
get{ return strName;}
set{ strName = value;}
}
protected string strClassName = null;
public string ClassName
{
get{ return strClassName;}
set{ strClassName = value;}
}
protected string strValue = null;
public string Value
{
get{ return strValue ;}
set{ strValue = value;}
}
protected string strOnClickContent = null;
public string OnClickContent
{
get{ return strOnClickContent;}
set{ strOnClickContent = value;}
}
public override string TagName
{
get
{
return "htmlbutton";
}
}
public DesignHtmlButton()
{
this.intTextColor = System.Drawing.SystemColors.ControlText ;
this.intBackColor = System.Drawing.SystemColors.Control ;
this.intAlign = System.Drawing.StringAlignment.Center ;
}
}
}
Because XHTMLDesigner can save result to a XML file , so other application can handle design result easy , and this XML file can send to XSLT transform .
Points of Interest
Every one know it is very hard to develop a WYSWYG designer , but using XDesignerLib middle ware , you can create your own WYSWYG designer fast and easy . What are you waiting for ? Try it at once .
Learn more information about XHTMLDesigner , please visit http://www.xdesigner.cn/xhtmldesigner/default-eng.htm .
Learn more information about XDesignerLib , please visit http://www.xdesigner.cn/xdesignerlib/default-eng.htm .
Lear more information about author , please visit http://www.xdesigner.cn/default-eng.htm or mail to yyf9989@hotmail.com .