DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using DevComponents.DotNetBar.Charts;
|
||||
|
||||
namespace DevComponents.Charts.Design
|
||||
{
|
||||
public class DataLabelCollectionEditor : BaseCollectionEditor
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private ChartSeries _ChartSeries;
|
||||
|
||||
#endregion
|
||||
|
||||
public DataLabelCollectionEditor(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
#region EditValue
|
||||
|
||||
public override object EditValue(
|
||||
ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||
{
|
||||
_ChartSeries = context.Instance as ChartSeries;
|
||||
|
||||
return (base.EditValue(context, provider, value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
protected override object CreateInstance(Type itemType)
|
||||
{
|
||||
if (itemType == typeof(DataLabel))
|
||||
{
|
||||
DataLabel label = (DataLabel)base.CreateInstance(itemType);
|
||||
|
||||
label.Name = _ChartSeries.DataLabels.GetUniqueName();
|
||||
|
||||
return (label);
|
||||
}
|
||||
|
||||
return (base.CreateInstance(itemType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyButton_Click
|
||||
|
||||
protected override void CopyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataLabel item = ChartItem as DataLabel;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (AddButton != null)
|
||||
{
|
||||
ChartControlDesigner ccd = GetDesigner(_ChartSeries.ChartControl);
|
||||
|
||||
ccd.InCopyItem = true;
|
||||
|
||||
try
|
||||
{
|
||||
AddButton.PerformClick();
|
||||
|
||||
DataLabelCollection dlc = _ChartSeries.DataLabels;
|
||||
DataLabel clone = dlc[dlc.Count - 1];
|
||||
|
||||
string name = clone.Name;
|
||||
item.CopyTo(clone);
|
||||
clone.Name = name;
|
||||
}
|
||||
finally
|
||||
{
|
||||
ccd.InCopyItem = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateCollectionItemType
|
||||
|
||||
protected override Type CreateCollectionItemType()
|
||||
{
|
||||
return typeof(DataLabel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user