Mini Kabibi Habibi
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using DevExpress.XtraBars;
using DevExpress.XtraEditors.Controls;
namespace DevExpress.XtraBars.Demos.Tutorials {
/// <summary>
/// Summary description for EditorItems.
/// </summary>
public partial class EditorItems : TutorialControl {
public EditorItems() {
//
// Required for Windows Form Designer support
//
InitializeComponent();
InitEditors();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
int step = 1;
int progress = 0;
private void InitEditors() {
foreach(BarItem item in barManager1.Items) {
repositoryItemComboBox1.Items.Add(item.Caption + " BarItem");
}
repositoryItemImageComboBox1.Items.Add(new ImageComboBoxItem("Align Left", ContentAlignment.MiddleLeft, 0));
repositoryItemImageComboBox1.Items.Add(new ImageComboBoxItem("Center", ContentAlignment.MiddleCenter, 1));
repositoryItemImageComboBox1.Items.Add(new ImageComboBoxItem("Align Right", ContentAlignment.MiddleRight, 2));
repositoryItemImageComboBox1.SmallImages = imageList1;
foreach(BarEditItem item in barManager1.Items)
item.EditValueChanged += new EventHandler(BarEditItem_ValueChange);
BarEditItem10.EditValueChanged -= new EventHandler(BarEditItem_ValueChange);
BarEditItem1.EditValue = "Button Edit";
BarEditItem2.EditValue = 15.5;
BarEditItem3.EditValue = true;
BarEditItem4.EditValue = panel1.BackColor;
BarEditItem5.EditValue = repositoryItemComboBox1.Items[0];
BarEditItem6.EditValue = DateTime.Now;
BarEditItem7.EditValue = ByteArrFromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("BarTutorials.EditorItems.Bars.gif"));
BarEditItem8.EditValue = "No more hassles or limits when it comes to using editors within a toolbar. XtraBars works in concert with our XtraEditors Library allowing you to use all our field editors (from date controls to combo boxes) directly within your toolbars.";
BarEditItem11.EditValue = 5.5;
BarEditItem12.EditValue = "Text Edit";
BarEditItem9.EditValue = ContentAlignment.MiddleCenter;
}
private byte[] ByteArrFromStream(System.IO.Stream str) {
byte[] result = new byte[str.Length];
str.Position = 0;
str.Read(result, 0, (int)str.Length);
str.Close();
return result;
}
private void timer1_Tick(object sender, System.EventArgs e) {
if(progress > 100) step = -1;
if(progress < 0) step = 1;
BarEditItem10.EditValue = (progress += step);
}
private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) {
DevExpress.XtraEditors.XtraMessageBox.Show("You pressed the button!", "Button Click");
}
private void BarEditItem_ValueChange(object sender, System.EventArgs e) {
BarEditItem item = sender as BarEditItem;
ChangeValueDescription(item.Caption, item.EditValue);
}
private void BarEditItem4_EditValueChanged(object sender, System.EventArgs e) {
panel1.BackColor = (Color)BarEditItem4.EditValue;
}
private void BarEditItem9_EditValueChanged(object sender, System.EventArgs e) {
label1.TextAlign = (ContentAlignment)BarEditItem9.EditValue;
}
private void ChangeValueDescription(string edit, object obj) {
string s = obj == null ? "<null>" : obj.ToString();
label1.Text = edit + " EditValueChanged - New Value: " + s;
}
}
}