|
|
|
|
|
using System;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Drawing.Design;
|
|
|
|
|
|
using System.Drawing.Drawing2D;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using System.Windows.Forms.Design;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GeoSigma.SigmaDrawerStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ UI <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class PropertyEditorWellCurveStyle : UITypeEditor
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
|
|
|
|
|
|
{
|
|
|
|
|
|
return UITypeEditorEditStyle.Modal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!(value is WellLineStyle style))
|
|
|
|
|
|
{
|
|
|
|
|
|
return value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IWindowsFormsEditorService edSvc = provider?.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
|
|
|
|
|
|
if (edSvc == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using (var editorForm = new WellCurveStyleEditForm(style))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (edSvc.ShowDialog(editorForm) == DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
WellLineStyle retStyle = new WellLineStyle();
|
|
|
|
|
|
retStyle.Color = editorForm.style.Color;
|
|
|
|
|
|
retStyle.Width = editorForm.style.Width;
|
|
|
|
|
|
retStyle.Style = editorForm.style.Style;
|
|
|
|
|
|
return retStyle;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override void PaintValue(PaintValueEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.Value is WellLineStyle style)
|
|
|
|
|
|
{
|
|
|
|
|
|
var g = e.Graphics;
|
|
|
|
|
|
var rect = e.Bounds;
|
|
|
|
|
|
|
|
|
|
|
|
using (var pen = new Pen(style.Color, (float)Math.Max(1, style.Width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> DashStyle<6C><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Solid <20><><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>Ϊʵ<CEAA>ߣ<EFBFBD>
|
|
|
|
|
|
pen.DashStyle = DashStyle.Solid;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>л<EFBFBD><D0BB><EFBFBD>
|
|
|
|
|
|
int y = rect.Top + (rect.Height / 2);
|
|
|
|
|
|
g.DrawLine(pen, rect.Left, y, rect.Right, y);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|