Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports DevExpress.XtraBars
Imports DevExpress.XtraEditors.Controls
Namespace DevExpress.XtraBars.Demos.Tutorials
''' <summary>
''' Summary description for EditorItems.
''' </summary>
Public Partial Class EditorItems
Inherits TutorialControl
Public Sub New()
'
' Required for Windows Form Designer support
'
InitializeComponent()
InitEditors()
'
' TODO: Add any constructor code after InitializeComponent call
'
End Sub
Private [step] As Integer = 1
Private progress As Integer = 0
Private Sub InitEditors()
For Each item As BarItem In barManager1.Items
repositoryItemComboBox1.Items.Add(item.Caption & " BarItem")
Next item
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
For Each item As BarEditItem In barManager1.Items
AddHandler item.EditValueChanged, AddressOf BarEditItem_ValueChange
Next item
RemoveHandler BarEditItem10.EditValueChanged, AddressOf 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("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
End Sub
Private Function ByteArrFromStream(ByVal str As System.IO.Stream) As Byte()
Dim result(Convert.ToInt32(str.Length)) As Byte
str.Position = 0
str.Read(result, 0, Convert.ToInt32(str.Length))
str.Close()
Return result
End Function
Private Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer1.Tick
If progress > 100 Then
[step] = -1
End If
If progress < 0 Then
[step] = 1
End If
progress += [step]
BarEditItem10.EditValue = progress
End Sub
Private Sub repositoryItemButtonEdit1_ButtonClick(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles repositoryItemButtonEdit1.ButtonClick
DevExpress.XtraEditors.XtraMessageBox.Show("You pressed the button!", "Button Click")
End Sub
Private Sub BarEditItem_ValueChange(ByVal sender As Object, ByVal e As System.EventArgs)
Dim item As BarEditItem = TryCast(sender, BarEditItem)
ChangeValueDescription(item.Caption, item.EditValue)
End Sub
Private Sub BarEditItem4_EditValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles BarEditItem4.EditValueChanged
panel1.BackColor = CType(BarEditItem4.EditValue, Color)
End Sub
Private Sub BarEditItem9_EditValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles BarEditItem9.EditValueChanged
label1.TextAlign = CType(BarEditItem9.EditValue, ContentAlignment)
End Sub
Private Sub ChangeValueDescription(ByVal edit As String, ByVal obj As Object)
Dim s As String
If obj Is Nothing Then
s = "<null>"
Else
s = obj.ToString()
End If
label1.Text = edit & " EditValueChanged - New Value: " & s
End Sub
End Class
End Namespace