Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/VB/PhotoViewer.MDI/Controls/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/VB/PhotoViewer.MDI/Controls/DateFilter.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports DevExpress.XtraEditors

Namespace PhotoViewer
	Partial Public Class DateFilter
		Inherits XtraUserControl
		Private Shared ReadOnly selectionChangedCore As Object = New Object()
		Public Sub New()
			InitializeComponent()
		End Sub
		Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
			MyBase.OnSizeChanged(e)
			Dim x As Integer = DisplayRectangle.X + CInt(Fix((DisplayRectangle.Width - calendar.Width) / 2))
			Dim y As Integer = DisplayRectangle.Y + CInt(Fix((DisplayRectangle.Height - calendar.Height) / 2))
			calendar.Location = New Point(x, y)
		End Sub
		Public ReadOnly Property StartDate() As DateTime
			Get
				If AllowFilter Then
					Return calendar.SelectionStart
				Else
					Return DateTime.MinValue
				End If
			End Get
		End Property
		Public ReadOnly Property EndDate() As DateTime
			Get
				If AllowFilter Then
					Return calendar.SelectionEnd
				Else
					Return DateTime.MinValue
				End If
			End Get
		End Property
		Public ReadOnly Property AllowFilter() As Boolean
			Get
				Return allowFilterCheck.Checked
			End Get
		End Property
		Protected Sub RaiseSelectionChanged()
			Dim handler As EventHandler = TryCast(Events(selectionChangedCore), EventHandler)
			If handler IsNot Nothing Then
				handler(Me, EventArgs.Empty)
			End If
		End Sub
		Public Custom Event SelectionChanged As EventHandler
			AddHandler(ByVal value As EventHandler)
				Events.AddHandler(selectionChangedCore, value)
			End AddHandler
			RemoveHandler(ByVal value As EventHandler)
				Events.RemoveHandler(selectionChangedCore, value)
			End RemoveHandler
			RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
			End RaiseEvent
		End Event
		Private Sub allowFilterCheck_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles allowFilterCheck.CheckedChanged
			RaiseSelectionChanged()
		End Sub
		Private Sub startDate_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs) Handles calendar.SelectionChanged
			RaiseSelectionChanged()
		End Sub
		Private Sub endDate_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
			RaiseSelectionChanged()
		End Sub
	End Class
End Namespace