Click here to Skip to main content
15,879,535 members
Articles / Desktop Programming / Windows Forms

Farsi Library - Working with Dates, Calendars, and DatePickers

Rate me:
Please Sign up or sign in to vote.
4.93/5 (235 votes)
21 Nov 2007MIT8 min read 2.9M   95.1K   202  
A library to work with "Persian Calendar", "Hijri Calendar", and "Gregorian Calendar" with WinForms GUI controls designed for Persian (Farsi) or Arabic language applications in mind, but usable in any Windows application that makes use of calendars and dates.
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms.Design;
using FarsiLibrary.Win.Controls;

namespace FarsiLibrary.Win.Design
{
    /// <summary>
    /// Design behavior of FADatePicker control
    /// </summary>
    internal class FADatePickerDesigner : FABaseDesigner
    {
        #region Initialize

        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            Verbs.Add(new DesignerVerb("Multiline", new EventHandler(OnMultilineChange)));
        }

        #endregion

        #region EventHandler

        private void OnMultilineChange(object sender, EventArgs e)
        {
            ChangeService.OnComponentChanging(Control, null);
            Control.Multiline = !Control.Multiline;
            ChangeService.OnComponentChanged(Control, null, null, null);
        }

        #endregion

        #region Props

        public new virtual FAContainerComboBox Control
        {
            get
            {
                return base.Control as FAContainerComboBox;
            }
        }

        #endregion

        #region Overrides

        public override SelectionRules SelectionRules
        {
            get
            {
                if (Control.Multiline)
                {
                    return SelectionRules.AllSizeable | SelectionRules.Moveable | SelectionRules.Visible;
                }
                else
                {
                    return SelectionRules.RightSizeable | SelectionRules.LeftSizeable | SelectionRules.Visible | SelectionRules.Moveable;
                }
            }
        }

        protected override void PreFilterProperties(IDictionary properties)
        {
            base.PreFilterProperties(properties);

            properties.Remove("Text");
            properties.Remove("AutoScroll");
            properties.Remove("AutoScrollMargin");
            properties.Remove("AutoScrollMinSize");
            properties.Remove("DockPadding");
            properties.Remove("DrawGrid");
            properties.Remove("MinimumSize");
            properties.Remove("MaximumSize");
            properties.Remove("Margin");
            properties.Remove("ForeColor");
            properties.Remove("BackColor");
            properties.Remove("BackgroundImage");
            properties.Remove("BackgroundImageLayout");
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer (Senior) Readify
Australia Australia
Working on both Java and .NET Technology, I have developed various enterprise level applications on both platforms. Currently, I am working as a Senior Software Developer at Readify which is a leading company on .NET technology in Australia.

Comments and Discussions