📄 defaultvb.aspx.vb
字号:
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports Telerik.QuickStart
Imports Telerik.WebControls
Namespace Telerik.ChartExamplesVB.Configurator.Elements.ChartSettings
'/ <summary>
'/ Summary description for _Default.
'/ </summary>
Public Class DefaultVB
Inherits XhtmlPage
Protected RadChart1 As Telerik.WebControls.RadChart
Protected Label4 As System.Web.UI.WebControls.Label
Protected Label1 As System.Web.UI.WebControls.Label
Protected Label2 As System.Web.UI.WebControls.Label
Protected Label3 As System.Web.UI.WebControls.Label
Protected Label5 As System.Web.UI.WebControls.Label
Protected Label6 As System.Web.UI.WebControls.Label
Protected txtBoxWidth As System.Web.UI.WebControls.TextBox
Protected txtBoxHeight As System.Web.UI.WebControls.TextBox
Protected txtBoxLeftMargin As System.Web.UI.WebControls.TextBox
Protected txtBoxRightMargin As System.Web.UI.WebControls.TextBox
Protected txtBoxTopMargin As System.Web.UI.WebControls.TextBox
Protected txtBoxBottomMargin As System.Web.UI.WebControls.TextBox
Protected Label7 As System.Web.UI.WebControls.Label
Protected ddlImageType As System.Web.UI.WebControls.DropDownList
Protected Label8 As System.Web.UI.WebControls.Label
Protected ddlImageQuality As System.Web.UI.WebControls.DropDownList
Protected Label9 As System.Web.UI.WebControls.Label
Protected ddlTextQuality As System.Web.UI.WebControls.DropDownList
Protected lblIncorrectSetting As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
InitControls()
SetControlValues()
End If
End Sub 'Page_Load
Private Sub InitControls()
InitControl(ddlImageQuality, GetType(ImageQuality))
InitControl(ddlTextQuality, GetType(TextQuality))
End Sub 'InitControls
Private Sub InitControl(ByVal ddList As DropDownList, ByVal type As Type)
Dim valueNames As String() = [Enum].GetNames(type)
ddList.Items.Clear()
Dim s As String
For Each s In valueNames
ddList.Items.Add(s)
Next s
End Sub 'InitControl
Private Sub SetControlValues()
txtBoxWidth.Text = RadChart1.Width.ToString()
txtBoxHeight.Text = RadChart1.Height.ToString()
txtBoxLeftMargin.Text = RadChart1.Margins.Left.ToString()
txtBoxRightMargin.Text = RadChart1.Margins.Right.ToString()
txtBoxTopMargin.Text = RadChart1.Margins.Top.ToString()
txtBoxBottomMargin.Text = RadChart1.Margins.Bottom.ToString()
SetControlValue(ddlImageQuality, RadChart1.ImageQuality.ToString())
SetControlValue(ddlTextQuality, RadChart1.TextQuality.ToString())
SetControlValue(ddlImageType, RadChart1.ChartImageFormat.ToString())
End Sub 'SetControlValues
Private Sub SetControlValue(ByVal ddList As DropDownList, ByVal val As String)
Dim listItem As listItem = ddList.SelectedItem
If Not (listItem Is Nothing) Then
listItem.Selected = False
End If
listItem = ddList.Items.FindByValue(val)
If Not (listItem Is Nothing) Then
listItem.Selected = True
End If
End Sub 'SetControlValue
#Region "Web Form Designer generated code"
Protected Overrides Sub OnInit(ByVal e As EventArgs)
'
' CODEGEN: This call is required by the ASP.NET Web Form Designer.
'
InitializeComponent()
MyBase.OnInit(e)
End Sub 'OnInit
'/ Required method for Designer support - do not modify
'/ the contents of this method with the code editor.
'/ </summary>
Private Sub InitializeComponent()
End Sub 'InitializeComponent
#End Region
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
ApplySettings()
lblIncorrectSetting.Visible = False
Catch
lblIncorrectSetting.Visible = True
End Try
End Sub 'Button1_Click
Private Sub ApplySettings()
RadChart1.Width = Unit.Parse(txtBoxWidth.Text)
RadChart1.Height = Unit.Parse(txtBoxHeight.Text)
RadChart1.Margins.Left = Unit.Parse(txtBoxLeftMargin.Text)
RadChart1.Margins.Right = Unit.Parse(txtBoxRightMargin.Text)
RadChart1.Margins.Top = Unit.Parse(txtBoxTopMargin.Text)
RadChart1.Margins.Bottom = Unit.Parse(txtBoxBottomMargin.Text)
RadChart1.ImageQuality = CType([Enum].Parse(GetType(ImageQuality), ddlImageQuality.SelectedItem.Value), ImageQuality)
RadChart1.TextQuality = CType([Enum].Parse(GetType(TextQuality), ddlTextQuality.SelectedItem.Value), TextQuality)
Dim ifc As New ImageFormatConverter()
RadChart1.ChartImageFormat = CType(ifc.ConvertFromString(ddlImageType.SelectedItem.Value), ImageFormat)
End Sub 'ApplySettings
End Class 'DefaultCS
End Namespace 'Telerik.ChartExamplesCS.ChartSettings
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -