Click here to Skip to main content
15,891,184 members
Articles / Web Development / ASP.NET
Article

Design Web Form use GDI+

Rate me:
Please Sign up or sign in to vote.
1.00/5 (11 votes)
14 Aug 20061 min read 122.9K   555   20   9
Introduce XHTMLDesigner , it can design Web Form use GDI+

Sample Image - xhtmldesigner.png

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 :

C#
using System;
using XDesignerDom ;
using XDesignerDom.ControlBase ;
namespace XDesigner.HtmlForm
{
    /// <summary>
    /// HTML&#25353;&#38062;&#23545;&#35937;
    /// </summary>
    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;
        /// <summary>
        /// &#23545;&#35937;&#21517;&#31216;
        /// </summary>
        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 .

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer duchang soft
China China
yuan yong fu of duchang soft , come from CHINA , 2008 Microsoft MVP,Use GDI+,XML/XSLT, site:http://www.cnblogs.com/xdesigner/

Comments and Discussions

 
Generalso many Chinaese people Pin
zanecode11-Oct-10 18:59
zanecode11-Oct-10 18:59 
GeneralI need it Pin
wlhchypx20-Nov-08 19:47
wlhchypx20-Nov-08 19:47 
Smile | :) Big Grin | :-D
QuestionIs the source for XDesignerLib.dll available? Pin
Rajesh Pillai16-Aug-06 6:28
Rajesh Pillai16-Aug-06 6:28 
GeneralYOU MUST WRITE IN PROPER ENGLISH! [modified] Pin
Dario Solera15-Aug-06 11:54
Dario Solera15-Aug-06 11:54 
GeneralRe: YOU MUST WRITE IN PROPER ENGLISH! [modified] Pin
i.Posei15-Aug-06 18:22
i.Posei15-Aug-06 18:22 
GeneralRe: YOU MUST WRITE IN PROPER ENGLISH! Pin
dtk15-Aug-06 18:27
dtk15-Aug-06 18:27 
Generalhehe,from china! Pin
i.Posei15-Aug-06 5:42
i.Posei15-Aug-06 5:42 
GeneralRe: hehe,from china! Pin
i.Posei15-Aug-06 5:42
i.Posei15-Aug-06 5:42 
GeneralRe: hehe,from china! Pin
i.Posei15-Aug-06 5:46
i.Posei15-Aug-06 5:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.