📄 webcontrolsizeeditor.cs
字号:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Web.UI.WebControls;
using System.Web.UI.Design.WebControls;
using System.Windows.Forms.Design;
using System.Windows.Forms;
namespace WroxDesign.Design
{
public class WebControlSizeEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value)
{
//Always return a valid value.
object retvalue = value;
IWindowsFormsEditorService srv = null;
//Get the forms editor service from the provider, to display the form.
if (provider != null)
srv = (IWindowsFormsEditorService)
provider.GetService(typeof(IWindowsFormsEditorService));
if (srv != null)
{
WebControlSizeForm form = new WebControlSizeForm();
form.CurrentSize = (WebControlSize)value;
if (srv.ShowDialog(form) == DialogResult.OK)
return form.CurrentSize;
}
return retvalue;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -