1

ZedGraph ペインでは、CurveItemを「選択済み」として設定できます。

zedGraphControl.GraphPane.CurveList[0].IsSelected = true;
zedGraphControl.Refresh();

Color.Grayこれは、私が見ることができる限り、その色を変更します。

この選択状態の色を変更することはできますか?

4

2 に答える 2

4

このようなプロパティはわかりませんが、ZedGraphControlのMouseClickイベントを手動でオーバーライドし、「選択された」CurveItemの色を次のように設定することでこれを実現できます。

private void zedGraphControl1_MouseClick(object sender, MouseEventArgs e)
    {
        foreach (var curve in zedGraphControl1.GraphPane.CurveList)
        {
            curve.Color = Color.Black;
        }

        CurveItem nearestItem;
        int nearestPoint;
        zedGraphControl1.GraphPane.FindNearestPoint(e.Location, out nearestItem, out nearestPoint);
        if (nearestItem != null)
        {
            nearestItem.Color = Color.Red;
        }
        zedGraphControl1.Refresh();
    }

更新: http ://www.opensourcejavaphp.net/csharp/zedgraph/Line.cs.htmlおよびhttp://www.opensourcejavaphp.net/csharp/zedgraph/Selection.cs.htmlのソースコードを見ると、 Line.DrawCurveは静的プロパティSelection.Lineを使用しています。ソースを変更しないと、この動作を変更するのは困難です。

Line.csの一部:

public void DrawCurve( Graphics g, GraphPane pane, CurveItem curve, float scaleFactor )
{
    Line source = this;
    if ( curve.IsSelected )
        source = Selection.Line;

Selection.cs:

/// The <see cref="Line" /> type to be used for drawing "selected"
/// <see cref="LineItem" /> and <see cref="StickItem" /> types
 /// </summary>
public static Line Line = new Line( Color.Gray );
于 2012-08-09T07:30:47.033 に答える