using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Globalization; using System.IO; using System.Resources; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Web.UI; using System.Web.UI.Design; using System.Web.UI.WebControls; using Interspire.DevEdit; namespace Interspire.DevEdit.Design { /// /// Summary description for DevEditDesigner. /// public class DevEditDesigner : System.Web.UI.Design.ControlDesigner { public override string GetDesignTimeHtml() { // Component is the instance of the component or control that // this designer object is associated with. This property is // inherited from System.ComponentModel.ComponentDesigner. Panel oPanel = new Panel(); DevEdit oControl = (DevEdit)Component; StringWriter sw = new StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(sw); oPanel.Height = oControl.Height; oPanel.Width = oControl.Width; oPanel.BackColor = Color.LightGray; oPanel.ForeColor = Color.DimGray; oPanel.BorderStyle = BorderStyle.Solid; oPanel.BorderColor = Color.Gray; oPanel.BorderWidth = Unit.Parse("1px"); oPanel.Style.Add("padding", "5px 5px 5px 5px"); oPanel.Style.Add("overflow", "auto"); Label oDevEditLabel = new Label(); oDevEditLabel.Text = "DevEdit Pro"; oDevEditLabel.Font.Name = "Verdana"; oDevEditLabel.Font.Bold = true; oDevEditLabel.Font.Size = FontUnit.Large; oDevEditLabel.ForeColor = Color.RoyalBlue; oPanel.Controls.Add(oDevEditLabel); Label oContentLabel = new Label(); if(oControl.Text != "" && oControl.Text != null){ oContentLabel.Text = "
" + HttpUtility.HtmlEncode(oControl.Text); oContentLabel.Font.Name = "Lucida Console"; oContentLabel.Font.Size = FontUnit.Point(8); oPanel.Controls.Add(oContentLabel); } try{ oPanel.RenderControl(tw); } catch(Exception err){ return GetErrorDesignTimeHtml(err); } return sw.ToString(); } protected override string GetErrorDesignTimeHtml(Exception err){ string text = string.Format("{0}{1}{2}{3}", "There was an error and the control can't be displayed", "

",err.ToString(),"
"); return CreatePlaceHolderDesignTimeHtml(text); } } }