⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webcontrolsizeeditor.vb

📁 ASP.NET服务器控件高级编程电子书
💻 VB
字号:
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Drawing.Design
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Windows.Forms.Design
Imports System.Windows.Forms

Namespace WroxDesignVB.Design

    Public Class WebControlSizeEditor : Inherits UITypeEditor

        Public Overloads Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle
            Return UITypeEditorEditStyle.Modal
        End Function

        Public Overloads Overrides Function EditValue(ByVal context As ITypeDescriptorContext, _
                    ByVal provider As IServiceProvider, ByVal value As Object) As Object

            'Always return a valid value.
            Dim retvalue As Object = value
            Dim srv As IWindowsFormsEditorService = Nothing

            'Get the forms editor service from the provider, to display the form.
            If Not (provider Is Nothing) Then
                srv = CType(provider.GetService(GetType(IWindowsFormsEditorService)), _
                    IWindowsFormsEditorService)
            End If

            If Not (srv Is Nothing) Then
                Dim form As WebControlSizeForm = New WebControlSizeForm()
                form.CurrentSize = CType(value, WebControlSize)
                If (srv.ShowDialog(form) = DialogResult.OK) Then
                    Return form.CurrentSize
                End If
            End If

            Return retvalue
        End Function

    End Class
End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -