|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Design;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace WordReportGenerator
{
/// <summary>
/// ��������� �������� IP ������ ��� PropertyGrid
/// </summary>
public class TextEditor : UITypeEditor
{
/// <summary>
/// ���������� ������ ��������������
/// </summary>
public override Object EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value)
{
if ((context != null) && (provider != null))
{
IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (svc != null)
{
using (TextEditorForm frm = new TextEditorForm((string)value))
{
if (svc.ShowDialog(frm) == DialogResult.OK)
value = frm.text;
}
}
}
return base.EditValue(context, provider, value);
}
/// <summary>
/// ���������� ����� ��������� - ��������� ����
/// </summary>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
if (context != null)
return UITypeEditorEditStyle.Modal;
else
return base.GetEditStyle(context);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have Master degree in Particle Physics. During my last several years I work as software developer.
Primary Interests
- c#, c++, php, java.
- scientific programming