📄 plaintexteditor.cs
字号:
#region License
/*
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#endregion
using System;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.Data;
namespace daReport.Editors
{
/// <summary>
/// Summary description for StaticTableEditor.
/// </summary>
public class PlainTextEditor : UITypeEditor
{
#region Creator
/// <summary>
/// Initializes a new instance of the PlainTextEditor class.
/// </summary>
public PlainTextEditor()
{
}
#endregion
#region Public Overrides
/// <summary>
/// Edits the value of the specified object using the editor style indicated by GetEditStyle.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <param name="provider">An IServiceProvider that this editor can use to obtain services. </param>
/// <param name="value">The object to edit. </param>
/// <returns>The new value of the object.</returns>
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
//return base.EditValue (context, provider, value);
// Attempts to obtain an IWindowsFormsEditorService.
IWindowsFormsEditorService edSvc = ((IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)));
//CType(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService)
if (edSvc == null)
return null;
//Displays a StringInputDialog Form to get a user-adjustable
//string value.
PlainTextEditorDialog f = new PlainTextEditorDialog();
f.Data = value as string;
if (edSvc.ShowDialog(f) == DialogResult.OK)
{
return f.Data;
}
//If OK was not pressed, return the original value
return value;
}
/// <summary>
/// Gets the editor style used by the EditValue method.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information. </param>
/// <returns>UITypeEditorEditStyle.Modal indicating the editor will be a modal form </returns>
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
//return base.GetEditStyle (context);
return UITypeEditorEditStyle.Modal;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -