private void xrGauge1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { if (!onFirstBeforePrint) { return; } XRGauge gauge = sender as XRGauge; ModifyGauge(gauge); }
public MainWindow() { InitializeComponent(); XtraReport1 rep = new XtraReport1(); XRGauge gauge = CreateGauge(); rep.Bands[BandKind.Detail].Controls.Add(gauge); viewer.DocumentSource = rep; }
private void ModifyGauge(XRGauge gauge) { DashboardGauge gaugeControl = gauge.Gauge as DashboardGauge; RemoveElements(gaugeControl); ArcScaleRangeBar rangeBar = new ArcScaleRangeBar() { ArcScale = gaugeControl.Elements[0] as ArcScale }; SetupArcScale(gaugeControl.Elements[0] as ArcScale); SetupRangeBar(gaugeControl, rangeBar); }
XRGauge CreateGauge() { XRGauge gauge = new XRGauge() { ViewType = DashboardGaugeType.Linear, ViewStyle = DashboardGaugeStyle.Full, SizeF = new SizeF(500, 200) }; IDashboardGauge gaugeControl = gauge.Gauge; var gaugeElements = gaugeControl.Elements; LinearScale linearScale = GetOrAdd <LinearScale>(gaugeElements); SetupLinearScale(linearScale); LinearScaleRangeBar rangeBar = GetOrAdd <LinearScaleRangeBar>(gaugeElements); SetupRangeBar(rangeBar); AddMarker(gaugeControl as DashboardGauge, 50f); return(gauge); }