//private void _RedrawBlock(ItemBlock block) { // int x = _TranslateX(block.Left); // int y = _TranslateY(block.Top); // Invalidate(new Rectangle(x, y, block.Width, block.Height)); //} private void DayPanel_MouseDown(object sender, MouseEventArgs e) { ItemBlock itemBlock = _GetItemAt(_TranslateX(e.X), _TranslateY(e.Y)); _SelectedBlock = itemBlock; OnItemClick(new ScheduleItemArgs((itemBlock != null) ? itemBlock.Item : null)); }
private void _DrawBlock(ItemBlock block, Graphics g) { int penWidth = block.Selected ? 3 : 1; using (Pen borderPen = new Pen(Color.Black, penWidth)) { _DrawRoundRect(g, borderPen, Brushes.White, block.Left, block.Top, block.Width - 1, block.Height - 1, 3); } g.DrawString(block.ProgramName, Font, Brushes.Black, new RectangleF(block.Left + 3, block.Top + 2, block.Width - 1, block.Height - 1)); }
private void DayPanel_MouseDoubleClick(object sender, MouseEventArgs e) { ItemBlock itemBlock = _GetItemAt(_TranslateX(e.X), _TranslateY(e.Y)); if (itemBlock != null) { OnItemDoubleClick(new ScheduleItemArgs(itemBlock.Item)); } else { double halfHour = _GetHalfHourAt(_TranslateY(e.Y)); OnTimeDoubleClick(new ScheduleEventArgs(0, TimeSpan.FromHours(halfHour / 2))); } }
private void _CalculateBlocks() { if (_updating) { return; } _blocks = new List <ItemBlock>(); foreach (ScheduleItem item in Items) { int top = _TimeToPixels(item.RunStartTime); int height = _TimeToPixels(item.RunEndTime - item.RunStartTime); ItemBlock block = new ItemBlock(item, top, Math.Max(height, 10)); _blocks.Add(block); } _layoutEngine.Layout(_blocks, new Rectangle(TimeGutter, 0, DisplayRectangle.Width - TimeGutter, DisplayRectangle.Height)); }
private void _DrawBlock(ItemBlock block, Graphics g) { int penWidth = block.Selected ? 3 : 1; using(Pen borderPen = new Pen(Color.Black, penWidth)) { _DrawRoundRect(g, borderPen, Brushes.White, block.Left, block.Top, block.Width - 1, block.Height - 1, 3); } g.DrawString(block.ProgramName, Font, Brushes.Black, new RectangleF(block.Left + 3, block.Top + 2, block.Width - 1, block.Height - 1)); }
private void _CalculateBlocks() { if(_updating) return; _blocks = new List<ItemBlock>(); foreach(ScheduleItem item in Items) { int top = _TimeToPixels(item.RunStartTime); int height = _TimeToPixels(item.RunEndTime - item.RunStartTime); ItemBlock block = new ItemBlock(item, top, Math.Max(height, 10)); _blocks.Add(block); } _layoutEngine.Layout(_blocks, new Rectangle(TimeGutter, 0, DisplayRectangle.Width - TimeGutter, DisplayRectangle.Height)); }