Click here to Skip to main content
Click here to Skip to main content

Design Web Form use GDI+

, 14 Aug 2006
Rate this:
Please Sign up or sign in to vote.
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 :

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

<!------------------------------- That's it! --------------------------->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

Share

About the Author

yuan yong fu
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 Pinmemberzanecode11-Oct-10 19:59 
GeneralI need it Pinmemberwlhchypx20-Nov-08 20:47 
QuestionIs the source for XDesignerLib.dll available? PinmemberRajesh Pillai16-Aug-06 7:28 
GeneralYOU MUST WRITE IN PROPER ENGLISH! [modified] PinmemberDario Solera15-Aug-06 12:54 
GeneralRe: YOU MUST WRITE IN PROPER ENGLISH! [modified] Pinmemberi.Posei15-Aug-06 19:22 
GeneralRe: YOU MUST WRITE IN PROPER ENGLISH! Pinmemberdtk15-Aug-06 19:27 
Generalhehe,from china! Pinmemberi.Posei15-Aug-06 6:42 
GeneralRe: hehe,from china! Pinmemberi.Posei15-Aug-06 6:42 
GeneralRe: hehe,from china! Pinmemberi.Posei15-Aug-06 6:46 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150128.1 | Last Updated 15 Aug 2006
Article Copyright 2006 by yuan yong fu
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid