C2018-039: Upgrade – User Control of Format

This commit is contained in:
2018-12-12 15:34:25 +00:00
parent ddf01e9f9a
commit bbcb638024
29 changed files with 4656 additions and 133 deletions

View File

@@ -0,0 +1,36 @@
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System;
namespace Volian.Base.Library
{
// The RtfEditor inherits from the UITypeEditor and is used to edit Rtf fields. This provides the interface for fields in FormatConfig
// and uses the frmRtfEdit to provide a mechanism to do basic editing of text with a subset of rtf command support.
public class RtfEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
string rw = value as string;
if (svc != null && rw != null)
{
using (frmRtfEdit form = new frmRtfEdit())
{
form.Value = rw;
if (svc.ShowDialog(form) == DialogResult.OK)
{
rw = form.Value; // update object
}
}
}
return rw;
}
}
}