求救高手:[C#]WebControl自定义控件,索引器,集合类,子控件的问题!!

zl_xue 2004-08-18 10:41:36
一gant 图!

我要做一个控件,包括一个Table,和若干条vml线。然后生成.dll,最后能在vs.net的工具箱重托拽过来并在属性才单中设置属性,包括没一条vml线的属性!!!

要实现这样的地东西:
WebVmlCtrl vml= new WebVmlCtrl();
vml[0].Color="red";

是不是类的结构不对??那应该怎么写???

-------------------------------------
部分代码:
namespace WebVmlCtrl
{
public class WebVmlCtrlControlBuilder : ControlBuilder
{
public override Type GetChildControlType(String tagName, IDictionary attributes)
{
if (String.Compare(tagName, "customitem", true) == 0)
{
return typeof(WebCustomControl1.Vline);
}
return null;
}
}

public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
{
private string text;

public string Text
{
get
{
return text;
}

set
{
text = value;
}
}

protected override void Render(HtmlTextWriter output)
{
Vline Vlines;
Text = jsEvent();
Text += "<div id='wins' style='height:200;width:200;overflow:auto ;background:#EEEEEE;'>";

//问题在这把,我如果调用这段东西。每次到这里Controls.Count =0!!!!!

for(int i = 0 ; i < Controls.Count ; i++ )
{
Vlines = (Vline) Controls[i];
Text += ((Vline) Controls[i]).Vml ;
}

Text += "</div>";
output.Write(Text);
}

//自定义vml line的属性设置。或者是给子控件?
public class Vline
{

private string vname="vml";
private int vxpt=0;
private int vypt=100;
private string vcolor="black";
private int vheight=3;
private int vlength=100;
private int vindex=0;
private string vml= "";
}
public string Vml
{
get
{
return vml="<vml:line>";
}
}

}
}
...全文
211 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zl_xue 2004-08-19
  • 打赏
  • 举报
回复
我是按照ASP.NET Color DropDown Control 修改的代码。可是错误。

上面错误的原因是什么??我迷惑了!

帮忙阿!!
zl_xue 2004-08-19
  • 打赏
  • 举报
回复
コンパイラ エラー メッセージ: CS0234: 型、または名前空間名 'WebVmlCtrl' は、クラスまたは名前空間 'WebVmlCtrl.WebVmlCtrl' に存在しません。アセンブリ参照があるか確認してください。

ソース エラー:



行 17: </FONT><FONT face="MS UI Gothic"></FONT><FONT face="MS UI Gothic"></FONT><FONT face="MS UI Gothic">
行 18: </FONT><FONT face="MS UI Gothic"></FONT><FONT face="Times New Roman">               
行 19: <cc1:WebVmlCtrl id="WebVmlCtrl1" runat="server"></cc1:WebVmlCtrl>
行 20: </FONT>
行 21: </form>

zl_xue 2004-08-18
  • 打赏
  • 举报
回复
3ks. but i 've no idea if i should used other controls!!!

if i should , how to do ?if not ,what should i do ?

i am not clearly the structure of the controls class. can u give me a help

ok , i loop up the website u gave me now!
saucer 2004-08-18
  • 打赏
  • 举报
回复
where did you create your other controls? take a look at
ASP.NET Color DropDown Control
http://www.codeproject.com/aspnet/HtmlColorDropDown.asp

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧