Exemplo n.º 1
0
 private void InvalidatePosition(Position pos)
 {
     Rectangle rect;
     if (pos.IsCaption)
     {
         rect = new Rectangle(0, 0, Width, 17);
     }
     else
     {
         rect = new Rectangle(pos.Column*24 + clientX, pos.Row*15 + clientY, 24, 15);
     }
     Invalidate(rect);
 }
Exemplo n.º 2
0
        private Position GetPosition(Point point)
        {
            // Der Mauszeiger ist oberhalb der Tage und Kalendarwochen
            if (point.Y < clientY)
            {
                if (point.Y < 20)
                {
                    return Position.Caption;
                }
                else
                {
                    return Position.Invalide;
                }
            }
            // Der Mauszeiger ist auf den Kalendarwochen
            if (point.X < 24)
            {
                int row = (point.Y - clientY)/15;
                if (this.weeks[row] == 0)
                {
                    return Position.Invalide;
                }
                else
                {
                    return new Position(-1, row);
                }
            }

            // Der Mauszeiger ist auf den Tagen
            var pos = new Position((point.X - clientX)/24, (point.Y - clientY)/15);
            int index = pos.Index;
            if (this.firstIndex <= index && index <= this.lastIndex)
            {
                return pos;
            }
            return Position.Invalide;
        }
Exemplo n.º 3
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            this.lastPosition = this.currentPosition;
            this.currentPosition = GetPosition(e.Location);

            if (this.currentPosition != this.lastPosition)
            {
                InvalidatePosition(this.lastPosition);
                DrawCursor();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///   Zeichnet einen Rahmen mit Hintergrund um eine Tag- oder Wochenzelle
        /// </summary>
        /// <param name = "g"></param>
        /// <param name = "pos"></param>
        private void DrawDayAndWeekCursor(Graphics g, Position pos)
        {
            int x = pos.Column*24 + clientX;
            int y = pos.Row*15 + clientY;
            var bounds = new Rectangle(x, y, 23, 14);
            var path = graphicPathHelper.GetRoundedRect(bounds);
            var brush = new LinearGradientBrush(bounds, cursorBackColor1, cursorBackColor2, LinearGradientMode.Vertical);
            g.FillPath(brush, path);
            g.DrawPath(cursorBorderPen, path);
            string s = (pos.IsWeek ? this.weeks[pos.Row] : this.days[pos.Index]).ToString();

            g.DrawString(s, dayFont, cursorTextBrush, x + textOffsetX, y + textOffsetY, dayStringFormat);
        }
Exemplo n.º 5
0
 /// <summary>
 ///   Wird ausgelöst wenn der Mauscursor das Panel verlässt.
 ///   Wenn die letzte Postion des Cursorsgültig war,
 ///   wird diese neu gezeichnet.
 /// </summary>
 /// <param name = "e"></param>
 protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     if (this.currentPosition.IsValid)
     {
         InvalidatePosition(this.currentPosition);
     }
     this.lastPosition = this.currentPosition = Position.Invalide;
 }