You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

继承标准TextBox控件后,能否在设计器视图中显示默认样式?

继承TextBox后如何在设计器中显示默认样式?

我继承了标准Windows Forms控件(比如TextBox),希望在设计器视图中直接看到它的默认TextBox样式,这样不用运行程序就能实时预览属性修改后的效果。

以下是我的.designer.vb代码:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ASearchBox
    Inherits TextBox

'UserControl overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    Try
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
    Finally
        MyBase.Dispose(disposing)
    End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.  
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
    components = New System.ComponentModel.Container()
    'Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
End Sub

End Class

目前设计器里显示的不是我想要的效果——它只展示了一个空白的容器区域,而非标准的TextBox输入框样式。

请问是否可以实现让设计器显示默认TextBox样式的需求?


内容的提问来源于stack exchange,提问作者okkko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 23:18:42