在 Visual Studio 设计视图上隐藏单选框和复选框名称

发布于 2024-08-03 06:33:43 字数 145 浏览 5 评论 0原文

我一直在 Visual Studio 2008 中设计控件,您可能已经注意到,当我使用 ASP .NET 的单选按钮和复选框 Web 控件时,它会在设计视图上显示名称,这导致我看到奇怪的预览,因为文本过宽。我想知道 Visual Studio 中是否有任何设置可以关闭此功能?

I have been designing controls in Visual Studio 2008 and as you may have notice when I use radio button and checkbox web controls for ASP .NET it shows the name on design view, this causes me to see an odd preview because the text are unnecessarily wide. I was wondering if there is any settings in visual studio to turn this off?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你怎么敢 2024-08-10 06:33:43

我认为 Visual Studio 中没有设置。
但这里有一个解决方案,您可以如何做到这一点:

继承 CheckBox 并分配一个新的设计器。

这是一个非常基本的示例(经过测试并且有效):

public class MyCheckBoxDesigner : CheckBoxDesigner
{
    public override string GetDesignTimeHtml()
    {
        return "<input type=checkbox />";
    }

}

[Designer(typeof(MyCheckBoxDesigner))]
public class MyCheckBox : CheckBox
{

}

I don't think there is a setting in Visual Studio.
But here a Solution how you can do it:

Inherit from CheckBox and assign a new Designer.

Here a very basic exsample (tested and it works):

public class MyCheckBoxDesigner : CheckBoxDesigner
{
    public override string GetDesignTimeHtml()
    {
        return "<input type=checkbox />";
    }

}

[Designer(typeof(MyCheckBoxDesigner))]
public class MyCheckBox : CheckBox
{

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文