protected void OnTimerFire(object sender, System.Timers.ElapsedEventArgs e) { if (_state == TaskBoxStates.Collapsing) { this.Size = new Size(this.Width, this.Height - 2); if (this.Height <= _header.Size.Height) { _state = TaskBoxStates.Collapsed; _timer.Enabled = false; Invalidate(); if (TaskBoxCollapsed != null) { TaskBoxCollapsed(this, null); } } } else if (_state == TaskBoxStates.Expanding) { this.Size = new Size(this.Width, this.Height + 2); if (this.Height >= _expanded_height) { _state = TaskBoxStates.Expanded; _timer.Enabled = false; Invalidate(); if (TaskBoxExpanded != null) { TaskBoxExpanded(this, null); } } } }
protected void CollapseTaskBox() { //_state = TaskBoxStates.Collapsing; _state = TaskBoxStates.Collapsed; this.Height = _header.Size.Height; TaskBoxCollapsed(this, null); Invalidate(); //_timer.Enabled = true; }
protected void ExpandTaskBox() { //_state = TaskBoxStates.Expanding; _state = TaskBoxStates.Expanded; this.Height = _expanded_height; TaskBoxExpanded(this, null); Invalidate(); //_timer.Enabled = true; }
private void InitializeComponent() { this.Left = 10; this.Width = 185; _tasks = new TaskCollection(); _details = new Hashtable(); //properties this.BackColor = _base_color; this.Visible = true; //events _tasks.Changed += new EventHandler(this.OnTasksChanged); //internal properties _state = TaskBoxStates.Expanded; _timer = new System.Timers.Timer(); _timer.Interval = 75; _timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimerFire); _header = new TaskBoxHeader(this); _header.Location = this.Location; }