webcontrolsizeeditor.vb
来自「ASP.NET服务器控件高级编程电子书」· VB 代码 · 共 44 行
VB
44 行
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 + =
减小字号Ctrl + -
显示快捷键?