1. 程式人生 > >DevExpress_常用控制元件15_Common Controls

DevExpress_常用控制元件15_Common Controls

3.1 TextEdit控制元件

以文字框的形式繫結各種形式的選擇框;

文字框設定輸入字元時有* 號掩蓋輸入的字元,程式碼如下:

textEdit1.Propertiex.PasswordChar=’*’;

3.2 ButtonEdit控制元件

以button按鈕的形式繫結各種形式的選擇框;

3.3 CheckButton控制元件

以按鈕的形式顯示Check的操作;

3.3.1其Button Style屬性設定Checked和UnChecked時的樣式;

可以在其DX Image Gallery中用其內不的自帶圖片,當Check的狀態發生改變時可以用

  this.checkButton1.Image = global::WindowsDev.Properties.Resources.clear_32x32;改變其內部自帶的圖片

3.4 ListBoxControl控制元件

示例程式碼:

string[] States = { "Alabama", "Alaska" };             

// Initialize and create an instance of the ListBoxControl class

ListBoxControl listBox = new ListBoxControl();

// Define the parent control

listBox.Parent = this;

// Set the listBox's background color

listBox.BackColor = Color.FromArgb(254, 246, 212);

// Dock to all edges and fill the parent container

listBox.Dock = DockStyle.Fill;

// Add items

listBox.Items.AddRange(States);

3.15 DropDownButton控制元件

    該控制元件以按鈕的形式彈出上下文選單,該控制元件通過DropDownControl屬性繫結PopuMenu控制元件或PopupControlContainer控制元件。

    可以通過該控制元件的DropDownArrowStyle屬性控制下拉箭頭的顯示模式,如圖:

3.6 PictureEdit控制元件

可在控制元件裡新增圖片

3.7 LabelControl控制元件

用法等同於Label控制元件

3.8 RadioGroup控制元件

其Columns屬性決定顯示的列數,

示例程式碼:

using DevExpress.XtraEditors.Controls;

///

///

object[] itemValues = new object[] {10, 11, 12, 13, 14};

string [] itemDescriptions = new string [] {"Circle", "Rectangle", "Ellipse", "Triangle", "Square"};

for(int i = 0; i < itemValues.Length; i++) {

    radioGroup1.Properties.Items.Add(new RadioGroupItem(itemValues[i], itemDescriptions[i]));

}

//Select the Rectangle item.

radioGroup1.EditValue = 11;

3.9MarqueeProgressBarControl

Text屬性顯示在運動時顯示的文字;

其Properties屬性下的MarqueeAnimationSpeed屬性控制其滾動速度

如圖所示:

marqueeProgressBarControl1.Properties.MarqueeAnimationSpeed = 100;

 marqueeProgressBarControl1.Text = "Loading...";

3.11 ImageListBoxControl

ImageListBoxControl與ListBoxControl的區別是其列表框中的每一項都有顯示圖片的能力;

 imageListBoxControl1.Items.Add("One");

     imageListBoxControl1.Items.Add("Two");

    imageListBoxControl1.Items.Add("Third");

     imageListBoxControl1.Items[0].ImageIndex = 0;



            imageListBoxControl1.Items[1].ImageIndex = 0;

        imageListBoxControl1.Items[2}.ImageIndex = 0;

3.12 SpinEdit控制元件

   此按鈕控制元件是用來增加或減少在編輯的文字編輯區顯示的數值,該編輯值可以是一個整數或浮點數。

其Text屬性顯示編輯區的文字;

其Value屬性獲得編輯區的值;

示例程式碼:spinEdit1.Text =( spinEdit1.Value +1).ToString();

3.13 ProgressPanel控制元件

   該控制元件是用來表示任何操作的進度,該控制元件包含一個動畫影象和兩個標籤,其中兩個標籤分別用來指定標題和描述屬性;

如圖:

  ProgressPanel包含了許多影象,可以手動指定顯示的影象格式,通過LookAndFeel屬性來設定,示例程式碼:

DevExpress.XtraWaitForm.ProgressPanel progressPanel1=new DevExpress.XtraWaitForm.ProgressPanel();

            this.progressPanel1.LookAndFeel.SkinName = "DevExpress Dark Style";

            this.progressPanel1.LookAndFeel.Style=       DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat;

            this.progressPanel1.LookAndFeel.UseDefaultLookAndFeel = false;

3.14 SimpleButton控制元件

使用SimpleButton控制建立一個Button按鈕,可以通過其Image屬性新增圖片;該控制元件與WinForm自帶的Button按鈕類同;

4、Rich Text Editor

1、RichEditControl控制元件

 該控制元件可以生成類似Word文件的文字編輯器,可以通過CreateBarManger方法自動生成相應的選單項;

5、Scheduling

5.1 SchedulerControl

   該控制元件以視覺化的效果顯示預約或者設定的行程;該控制元件預約後的資料儲存在SchedulerStorage物件裡,當以拖動形式新增SchedulerControl控制元件時,系統會自動分配一個SchedulerStorage物件。

 5.2、DateNavigator控制元件

該控制元件是一個可以快速在SchedulerControl控制元件中進行日期排程的控制元件,利用其schedulercontrol屬性與SchedulerControl控制元件進行繫結;

示例程式碼:

 // Hide the Today button.

   dateNavigator1.ShowTodayButton = false;

   // Assign the existing Scheduler Control to this Date Navigator.

   dateNavigator1.SchedulerControl = schedulerControl1;

圖片演示:

6、Spreadsheet

1、SpreadsheetControl控制元件

該控制元件生成Excel表格,可以通過CreateBarManger方法自動生成相應的選單項;

2、SpreadSheetNameBoxControl控制元件

該控制元件可以結合SpreadSheetControl控制元件一起使用,可以顯示當前選中的是哪個單元格;

3、SpreadsheetFomulaBarControl控制元件

該控制元件結合SpreadSheetControl控制元件一起使用,可以顯示對幾個單元格中的值進行計算;