ComponentOne Chart for .NET (2.0) Search HelpCentral 

Creating a Hatched Brush

The following sample code represents the handler that creates hatched brush.

Please note that the given code snippet shows the initial declarations of some objects using their full namespace. In subsequent use of those and related objects, the namespace is omitted for brevity.

·      Visual Basic

Private Sub C1Chart1_DrawDataSeries(ByVal sender As Object, _
  ByVal e As C1.Win.C1Chart.DrawDataSeriesEventArgs) _
   Handles C1Chart1.DrawDataSeries

    Dim ds As C1.Win.C1Chart.ChartDataSeries = sender

    Dim foreclr As Color = ds.SymbolStyle.Color

    Dim backclr As Color = ds.LineStyle.Color

 

    Dim hb As System.Drawing.Drawing2D.HatchBrush

    hb = New HatchBrush(HatchStyle.OutlinedDiamond, foreclr, backclr)

    e.Brush = hb

End Sub

·      C#

private void C1Chart1_DrawDataSeries(object sender,
   C1.Win.C1Chart.DrawDataSeriesEventArgs e)

{

  C1.Win.C1Chart.ChartDataSeries ds = (ChartDataSeries)sender;

  Color forecolor = ds.SymbolStyle.Color;

  Color backcolor = ds.LineStyle.Color;

 

  System.Drawing.Drawing2D.HatchBrush hb;

  hb = new HatchBrush(HatchStyle.OutlinedDiamond, forecolor, backcolor);

  e.Brush = hb;

}

·      Delphi

procedure Class1.c1Chart1_DrawDataSeries(sender: System.Object;

  e: C1.Win.C1Chart.DrawDataSeriesEventArgs);var

  ds: C1.Win.C1Chart.ChartDataSeries;

  forecolor:  Color;

  backcolor:  Color;

  hb:  System.Drawing.Drawing2D.HatchBrush;

begin

  ds = ChartDataSeries(sender);

  forecolor := ds.SymbolStyle.Color;

  backcolor := ds.LineStyle.Color;

  hb := HatchBrush.Create(HatchStyle.OutlinedDiamond, forecolor, backcolor);

  e.Brush := hb;

end;

The following image displays the hatch brush bar chart:


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.