DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using DevComponents.DotNetBar.Charts;
|
||||
|
||||
namespace DevComponents.Charts.Design
|
||||
{
|
||||
public class PieReferenceCollectionEditor : BaseCollectionEditor
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private SliceVisualLayout _SliceLayout;
|
||||
|
||||
#endregion
|
||||
|
||||
public PieReferenceCollectionEditor(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
#region EditValue
|
||||
|
||||
public override object EditValue(
|
||||
ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||
{
|
||||
_SliceLayout = context.Instance as SliceVisualLayout;
|
||||
|
||||
IComponentChangeService cs = BeforeEditValue(context);
|
||||
|
||||
object retval = value;
|
||||
|
||||
try
|
||||
{
|
||||
retval = base.EditValue(context, provider, value);
|
||||
}
|
||||
finally
|
||||
{
|
||||
AfterEditValue(context, cs);
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
protected override object CreateInstance(Type itemType)
|
||||
{
|
||||
if (itemType == typeof(PieReferenceLine))
|
||||
{
|
||||
PieReferenceLine line = (PieReferenceLine)base.CreateInstance(itemType);
|
||||
|
||||
line.Name = _SliceLayout.ReferenceLines.GetUniqueName();
|
||||
|
||||
return (line);
|
||||
}
|
||||
|
||||
return (base.CreateInstance(itemType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyButton_Click
|
||||
|
||||
protected override void CopyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PieReferenceLine item = ChartItem as PieReferenceLine;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (AddButton != null)
|
||||
{
|
||||
ChartVisualElement cve = _SliceLayout.Parent as ChartVisualElement;
|
||||
|
||||
ChartControlDesigner ccd = (cve != null) ? GetDesigner(cve.ChartControl) : null;
|
||||
|
||||
if (ccd != null)
|
||||
ccd.InCopyItem = true;
|
||||
|
||||
try
|
||||
{
|
||||
AddButton.PerformClick();
|
||||
|
||||
PieReferenceLineCollection rlc = _SliceLayout.ReferenceLines;
|
||||
PieReferenceLine clone = rlc[rlc.Count - 1];
|
||||
|
||||
string name = clone.Name;
|
||||
item.CopyTo(clone);
|
||||
clone.Name = name;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (ccd != null)
|
||||
ccd.InCopyItem = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateCollectionItemType
|
||||
|
||||
protected override Type CreateCollectionItemType()
|
||||
{
|
||||
return typeof(PieReferenceLine);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user