自定义控件无法在VS.net编辑中显示

该博客为转载内容,转载自https://www.cnblogs.com/king_astar/archive/2004/09/25/46519.html ,原内容可能与UI相关。
自己写了一个用户控件,拖入到编辑框只有如下图的样子,连鼠标都无法选中,怎么解决?

----------图片下方--------------------
Snap1.gif

而正常的控件应该是:
Snap3.gif

===============
update by rock jing on 2004-9-25
===============
我定义了设计时的类,用来显示,设计时候控件显示的模样。
None.gifpublic class SampleDesign
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
InBlock.gif        
public class SampleDesigner : System.Web.UI.Design.ControlDesigner
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
InBlock.gif            
public override string GetDesignTimeHtml() 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
// Component is the control instance, defined in the base
InBlock.gif                
// designer
InBlock.gif
                MyLabel myLable = (MyLabel)this.Component;
InBlock.gif                
string html = myLable.GetHtml();
InBlock.gif
InBlock.gif                
return html;
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif            
protected override string GetEmptyDesignTimeHtml()
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                String html 
=  base.GetEmptyDesignTimeHtml ();
InBlock.gif                html 
= "<input type='text'"+html+">";
InBlock.gif                
return html;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
protected override string GetErrorDesignTimeHtml(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif
InBlock.gif                String html 
=  base.GetErrorDesignTimeHtml (e);
InBlock.gif                html 
= "<input type='text'"+html+">";
InBlock.gif                
return html;
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif
InBlock.gif        
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedBlockEnd.gif    }

结果,出现了创建控件出错。指定转换无效
Snap4.gif

转载于:https://www.cnblogs.com/king_astar/archive/2004/09/25/46519.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值