DevExpress 控件用法笔记(VB)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DevExpress 控件用法笔记(VB)相关的知识,希望对你有一定的参考价值。

1、ChartControl

显示条形图

            ChartControl1.Titles.Clear()
            ChartControl1.Series.Clear()
            Dim db As DataTable
            SqlDataAdapter1.SelectCommand.CommandText =sqlstr
            db = New DataTable
            SqlDataAdapter1.Fill(db)
            Dim series1 As DevExpress.XtraCharts.Series = New DevExpress.XtraCharts.Series("", ViewType.Line)
            series1.DataSource = db‘绑定数据源
            series1.ArgumentDataMember = "TimeStep" X轴显示字段
            series1.ValueDataMembers(0) =cbPara.Text ‘Y轴显示字段
            series1.Name = cbPara.Text ’图例名称
            ChartControl1.Series.Add(series1)
            标题
            Dim chartTitle1 As New ChartTitle()
            chartTitle1.Text = cbPara.SelectedItem & "浓度变化曲线"
            chartTitle1.Antialiasing = True
            chartTitle1.Font = New Font("Tahoma", 14, FontStyle.Regular)
            chartTitle1.TextColor = Color.Black
            chartTitle1.Indent = 10
            ChartControl1.Titles.Add(chartTitle1)
添加x,y轴标题
Dim diam As DevExpress.XtraCharts.XYDiagram = New DevExpress.XtraCharts.XYDiagram
diam.AxisX.Title.Text = "mg/L"
diam.AxisY.Title.Text = ""
diam.AxisX.Title.Visible = True
diam.AxisY.Title.Visible = True
ChartControl1.Diagram = diam

 

效果如下:

技术分享

2、   GridControl

绑定代码如下:

GridControl1.DataSource = db  ‘db是DataTable对象

自定义字段显示如下图:

技术分享

 

去掉GroupPanel如下图所示:

技术分享

3、   WinForm的ComboBox自定义绑定数据

自已定义一个RiverData类的代码:

 

    Public Class RiverData
        Dim m_riverName As String
        Dim m_riverId As String
        Dim m_evtsimId As String

        Public Property RiverName
            Get
                Return m_riverName
            End Get
            Set(ByVal value)
                m_riverName = value
            End Set
        End Property

        Public Property RiverId
            Get
                Return m_riverId
            End Get
            Set(ByVal value)
                m_riverId = value
            End Set
        End Property

        Public Property EvtSimId
            Get
                Return m_evtsimId
            End Get
            Set(ByVal value)
                m_evtsimId = value
            End Set
        End Property


    End Class

 

绑定数据的代码如下:

  Dim m_river As RiverData = New RiverData
        m_river.RiverName = tName
        m_river.RiverId = tRiver
        cbSec.Items.Add(m_river)
        cbSec.DisplayMember = "RiverName"
        cbSec.ValueMember = "RiverId"

 

以上是关于DevExpress 控件用法笔记(VB)的主要内容,如果未能解决你的问题,请参考以下文章

DEVEXPRESS如何将控件的添加界面设置成中文

如何在VS工具箱中添加DevExpress控件

DevExpress 第三方控件,使用笔记

如何在VS工具箱中添加DevExpress控件

vb.net中treeview控件用法

vb timer控件的用法