DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using DevComponents.DotNetBar.Charts;
|
||||
|
||||
namespace DevComponents.Charts.Design
|
||||
{
|
||||
public class ChartSeriesCollectionEditor : BaseCollectionEditor
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private BaseChart _BaseChart;
|
||||
|
||||
#endregion
|
||||
|
||||
public ChartSeriesCollectionEditor(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
#region EditValue
|
||||
|
||||
public override object EditValue(
|
||||
ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||
{
|
||||
_BaseChart = context.Instance as BaseChart;
|
||||
|
||||
return (base.EditValue(context, provider, value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
protected override object CreateInstance(Type itemType)
|
||||
{
|
||||
if (itemType == typeof(PieSeries) || itemType == typeof(ChartSeries))
|
||||
{
|
||||
BaseSeries series = (BaseSeries)base.CreateInstance(itemType);
|
||||
|
||||
series.Name = _BaseChart.BaseSeries.GetUniqueName();
|
||||
|
||||
return (series);
|
||||
}
|
||||
|
||||
return (base.CreateInstance(itemType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyButton_Click
|
||||
|
||||
protected override void CopyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
BaseSeries item = ChartItem as BaseSeries;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (AddButton != null)
|
||||
{
|
||||
AddButton.PerformClick();
|
||||
|
||||
ChartBaseSeriesCollection csc = _BaseChart.BaseSeries;
|
||||
BaseSeries clone = csc[csc.Count - 1];
|
||||
|
||||
string name = clone.Name;
|
||||
item.CopyTo(clone);
|
||||
clone.Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateCollectionItemType
|
||||
|
||||
protected override Type CreateCollectionItemType()
|
||||
{
|
||||
return (_BaseChart is PieChart ? typeof(PieSeries) : typeof(ChartSeries));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user