This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
57 lines (45 loc) · 1.78 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Imports System
Imports System.Linq
Imports System.Windows.Forms
Imports DevExpress.XtraBars
Imports DevExpress.XtraCharts
Imports DevExpress.XtraCharts.Printing
Namespace PrintCrosshairSample
Partial Public Class MainForm
Inherits DevExpress.XtraBars.Ribbon.RibbonForm
Private Property VM() As New MainViewModel()
Public Sub New()
InitializeComponent()
End Sub
Private Sub OnChartObjectHotTracked(ByVal sender As Object, ByVal e As HotTrackEventArgs)
If Not (TypeOf e.Object Is Series) Then
e.Cancel = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
InitChart()
End Sub
Private Sub InitChart()
Dim template = chartControl.SeriesTemplate
template.SeriesDataMember = "Company"
template.SetDataMembers("Category", "Value")
Dim view As New StackedBarSeriesView()
view.FillStyle.FillMode = FillMode.Solid
template.View = view
chartControl.DataSource = VM.TotalIncome
chartControl.OptionsPrint.SizeMode = PrintSizeMode.Zoom
AddHandler chartControl.ObjectHotTracked, AddressOf Me.OnChartObjectHotTracked
AddHandler chartControl.MouseUp, AddressOf Me.OnChartControlMouseUp
End Sub
Private Sub OnChartControlMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim diagram = CType(chartControl.Diagram, XYDiagram)
diagram.ShowCrosshair(e.Location)
End Sub
Private Sub OnShowPrintPreviewItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs) Handles bbiShowPrintPreview.ItemClick
chartControl.ShowPrintPreview()
End Sub
Private Sub OnPrintCrosshairItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs) Handles bciPrintCrosshair.ItemClick
chartControl.OptionsPrint.PrintCrosshair = bciPrintCrosshair.Checked
End Sub
End Class
End Namespace