Ejemplo n.º 1
0
 private void RemoveYearSelector(bool animate)
 {
     if (_CurrentOperation == eCurrentSingleMonthCalendarOperation.AnimatingHideYearSelector) return;
     if (animate)
     {
         _CurrentOperation = eCurrentSingleMonthCalendarOperation.AnimatingHideYearSelector;
         Rectangle targetBounds = new Rectangle(this.LeftInternal + (this.WidthInternal - 8) / 2, this.TopInternal + (this.HeightInternal - 8) / 2, 8, 8);
         DevComponents.DotNetBar.Animation.AnimationRectangle anim = new DevComponents.DotNetBar.Animation.AnimationRectangle(
             new AnimationRequest(_YearSelector, "Bounds", targetBounds),
             DevComponents.DotNetBar.Animation.AnimationEasing.EaseInOutQuad, 200);
         anim.AnimationCompleted += AnimationCompleted;
         anim.Start();
     }
     else
     {
         if (_YearSelector.Parent != null)
             _YearSelector.Parent.Controls.Remove(_YearSelector);
         _YearSelector.YearSelector.SelectedYearChanged -= YearSelectorSelectedYearChanged;
         _YearSelector.Dispose();
         _YearSelector = null;
     }
 }
Ejemplo n.º 2
0
 void AnimationCompleted(object sender, EventArgs e)
 {
     DevComponents.DotNetBar.Animation.AnimationRectangle anim = (DevComponents.DotNetBar.Animation.AnimationRectangle)sender;
     anim.Dispose();
     if (_YearSelector.Parent != null)
         _YearSelector.Parent.Controls.Remove(_YearSelector);
     _YearSelector.YearSelector.SelectedYearChanged -= YearSelectorSelectedYearChanged;
     _YearSelector.Dispose();
     _YearSelector = null;
     _CurrentOperation = eCurrentSingleMonthCalendarOperation.None;
 }
Ejemplo n.º 3
0
        private void ShowYearSelection(object sender, EventArgs e)
        {
            if (!_YearSelectionEnabled || _CurrentOperation != eCurrentSingleMonthCalendarOperation.None || this.Parent is MonthCalendarItem && (((MonthCalendarItem)this.Parent).CalendarDimensions.Width > 1 || ((MonthCalendarItem)this.Parent).CalendarDimensions.Height > 1))
                return;
            _CurrentOperation = eCurrentSingleMonthCalendarOperation.AnimatingShowYearSelector;
            _YearSelector = new YearSelectorControl();
            _YearSelector.Size = new Size(8, 8);
            _YearSelector.Location = new Point(this.LeftInternal + (this.WidthInternal - 8) / 2, this.TopInternal + (this.HeightInternal - 8) / 2);
            _YearSelector.Visible = true;
            _YearSelector.Style = eDotNetBarStyle.StyleManagerControlled;

            if (BarFunctions.IsOffice2007Style(this.Style))
            {
                Office2007ColorTable table = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;
                ElementStyle es = (ElementStyle)table.StyleClasses[ElementStyleClassKeys.ItemPanelKey];
                _YearSelector.BackgroundStyle.BackColor = es.BackColor;
                _YearSelector.BackgroundStyle.BackColor2 = es.BackColor2;
            }
            else
                _YearSelector.BackgroundStyle.BackColor = SystemColors.Window;
            ItemContainer nav = GetNavigationContainer();
            LabelItem label = nav.SubItems[NavMonthLabel] as LabelItem;

            if (this.EffectiveStyle != eDotNetBarStyle.Metro)
                _YearSelector.YearSelector.TextColor = label.ForeColor;

            Control cc = (Control)this.ContainerControl;
            cc.Controls.Add(_YearSelector);
            _YearSelector.YearSelector.CenturyYearStart = (this.DisplayMonth.Year / 10) * 10;
            _YearSelector.YearSelector.SelectedYear = this.DisplayMonth.Year;
            Rectangle targetBounds = this.Bounds;

            _YearSelector.YearSelector.SelectedYearChanged += YearSelectorSelectedYearChanged;

            DevComponents.DotNetBar.Animation.AnimationRectangle anim = new DevComponents.DotNetBar.Animation.AnimationRectangle(
                new AnimationRequest(_YearSelector, "Bounds", targetBounds),
                DevComponents.DotNetBar.Animation.AnimationEasing.EaseInOutQuad, 200);
            anim.AutoDispose = true;
            anim.AnimationCompleted += ShowAnimationCompleted;
            anim.Start();

        }