Web自定义控件设计时调整大小问题
yjdn 2006-02-17 03:49:58 我做了一个简单的自定义控件,但是不能在设计时调整大小,
我在控件里用的是HTML控件.但如果改成服务器控件的话,
是可以改变大小的,请问各位,有谁能解决这个问题?
下面是我控件的代码:
-----------------------------
using System;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.ComponentModel.Design;
namespace Skyendless.MyControls
{
/// <summary>
/// WebCustomControl1 的摘要说明。
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:Label runat=server></{0}:Label>")]
//[DesignerAttribute(typeof(Skyendless.Designers.Designer), typeof(IDesigner))]
public class Label : System.Web.UI.WebControls.WebControl
{
private string text;
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return text;
}
set
{
text = value;
}
}
/// <summary>
/// 将此控件呈现给指定的输出参数。
/// </summary>
/// <param name="output"> 要写出到的 HTML 编写器 </param>
protected override void Render(HtmlTextWriter output)
{
string ControlHTML ="<div name = "+this.UniqueID+" width = "+this.Width+">"+Text+"</div>";
output.Write(ControlHTML);
}
}
}