Download QCChart2D User Manual - Quinn

Transcript
FAQs 447
specific and it is up to the application programmer to provide these. The property
editor tables common to many packages are designed to be used by developers, not
end users.
You can add your own dialogs that edit the characteristics important to your end
users. If you want to select the chart object by pressing a mouse button while the
cursor is on the object, use the FindObj class. Override the OnMouseDown method
and invoke the appropriate dialog panel there. The following example is extracted
from the EditChartExample example program.
[C#]
public class LinePlot : EditChartExample.UserChartControl1
{
private System.ComponentModel.IContainer components = null;
public TimeAxis xAxis = null;
public LinearAxis yAxis = null;
class CustomFindObj: FindObj
{
LinePlot currentObj = null;
public CustomFindObj(LinePlot component): base(component)
{
currentObj = component;
}
public void InvokeLineDialog(GraphObj graphobj)
{
EditLineDialog linedialog = null;
linedialog = new EditLineDialog(graphobj);
if (liedialog.ShowDialog(this.GetChartObjComponent()) ==
DialogResult.OK )
{
}
selectedObj.SetColor( linedialog.GetLineColor());
selectedObj.SetLineStyle(linedialog.GetLineStyle());
selectedObj.SetLineWidth(linedialog.GetLineWidth());
}
public void InvokeTextDialog(ChartText textobj)
{
EditTextDialog textdialog = null;
textdialog = new EditTextDialog(textobj);
if (textdialog.ShowDialog(this.GetChartObjComponent())==
DialogResult.OK )
{
textobj.SetTextString(textdialog.GetString());
textobj.SetTextFont(textdialog.GetFont());
}
}
public override void OnMouseDown (MouseEventArgs mouseevent)
{
base.OnMouseDown(mouseevent);
GraphObj selectedObj = GetSelectedObject();
if (selectedObj != null)
{
// Check for a specific object
if ( (selectedObj == currentObj.xAxis) ||
(selectedObj == currentObj.yAxis) ||
// or check for for all classes inheriting from a specific type
(ChartSupport.IsKindOf(selectedObj,"SimpleLinePlot")) ||
// or Check for a specific object type
ChartSupport.IsType(selectedObj,"com.quinncurtis.chart2dnet.Grid")))