在仪表控件里添加图表控件
本帮助的内容需要更新Foxtable到最新版。
仪表控件其实是一个容器,可以把任意其它控件拖入里面,结合窗口新增加的自动布局属性,就可以让其它控件像仪表一样进行按比例缩放。
步骤一、打开窗口设计,把窗口属性:杂项-》自动调整布局 设置为true
步骤二、添加一个图表控件,拖入仪表控件中,图表控件的大小和位置拖动调整为合适的值
步骤三、到窗口afterload事件设置一下代码,把图表控件设置为透明无边框模式:
-
Dim Chart As WinForm.Chart
-
Chart = e.Form.Controls("Chart1")
-
Chart.Transparent = True '设置为透明模式
最后根据需要设置图标内容即可。
注意,图表的透明设置是针对父控件的,所以必须把图表拖放入仪表控件里,透明设置才起作用。
下面是一个图表的设置代码:
-
-
Dim t As Table = Tables("网站访问量")
-
Dim Chart As WinForm.Chart
-
Dim Series As WinForm.ChartSeries
-
Chart = e.Form.Controls("Chart1")
-
Chart.Transparent = True
-
Chart.VisualEffect = True
-
-
Chart.DataSource = "网站访问量"
-
-
Chart.AxisX.DateType = True
-
Chart.AxisX.AnnoFormatString = "M月d日"
-
Chart.AxisX.MajorTick = False
-
Chart.AxisX.MinorTick = False
-
Chart.AxisX.ForeColor = Color.White
-
Chart.AxisY.ForeColor = Color.White
-
Chart.AxisY2.ForeColor = Color.Transparent
-
Chart.AxisY.GridMinorVisible = False
-
Chart.AxisY.MinorTick = False
-
-
Chart.SeriesList.Clear()
-
Chart.ChartType = ChartTypeEnum.XYPlot
-
Series = Chart.SeriesList.Add()
-
Series.FitType = FitTypeEnum.Spline
-
Series.MarkShape = MarkShapeEnum.Circle
-
Series.MarkColor = Color.White
-
Series.X.DataField = "日期"
-
Series.Y.DataField = "数量"
-
Series.DataLabelText = "{#YVAL}"
-
Series.DataLabelForeColor = Color.FromArgb(57, 222, 222)
-
Series.DataLabelCompass =LabelCompassEnum.North
-
-
Chart.ChartType2 = ChartTypeEnum.Area
-
Chart.SeriesList2.Clear()
-
Series = Chart.SeriesList2.Add()
-
Series.FitType = FitTypeEnum.Spline
-
Series.X.DataField = "日期"
-
Series.Y.DataField = "数量"
-
Series.LineColor = Color.FromArgb(16, 148, 173)
效果: