โ03-16-2005 11:24 AM
โ03-16-2005 11:40 AM
โ03-16-2005 01:09 PM
private class BufferedPlot : WaveformPlot
{
private int _bufferSize;
private const int DefaultBufferSize = 1024;
public BufferedPlot()
{
_bufferSize = DefaultBufferSize;
}
[DefaultValue(DefaultBufferSize)]
public int BufferSize
{
get
{
return _bufferSize;
}
set
{
_bufferSize = value;
}
}
public override object Clone()
{
BufferedPlot clone = new BufferedPlot();
// Copy all properties that do not have their default values.
foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(this))
{
// Only set the value if it's not its default value.
if (pd.ShouldSerializeValue(this))
{
object propertyValue = pd.GetValue(this);
pd.SetValue(clone, propertyValue);
}
}
// Copy the plot data.
double[] yData = GetYData();
if (yData.Length > 0)
clone.PlotY(yData);
return clone;
}
}
โ03-16-2005 01:11 PM
โ03-16-2005 05:48 PM
โ03-16-2005 06:15 PM
public override object Clone()
{
BufferedPlot clone = new BufferedPlot();
foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(this))
{
// Only set the vlaue if it's writeable and its' not the default value.
if (!pd.IsReadOnly && pd.ShouldSerializeValue(this))
{
object propertyValue = pd.GetValue(this);
if (propertyValue is ICloneable)
propertyValue = ((ICloneable)propertyValue).Clone();
pd.SetValue(clone, propertyValue);
}
}
double[] yData = GetYData();
if (yData.Length > 0)
clone.PlotY(yData);
return clone;
}
โ03-17-2005 03:31 AM
โ03-17-2005 10:04 AM
public override object Clone()
{
BufferedPlot clone = new BufferedPlot();
foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(this))
{
if (pd.PropertyType.IsAssignableFrom(typeof(Axis)))
continue;
// Only set the vlaue if it's writeable and its' not the default value.
if (!pd.IsReadOnly && pd.ShouldSerializeValue(this))
{
object propertyValue = pd.GetValue(this);
if (propertyValue is ICloneable)
propertyValue = ((ICloneable)propertyValue).Clone();
pd.SetValue(clone, propertyValue);
}
}
double[] yData = GetYData();
if (yData.Length > 0)
clone.PlotY(yData);
return clone;
}