Example #1
0
 // <summary>
 //     Redirects to our command selection handler
 // </summary>
 private void OnExplorerSelectionChanged(ExplorerSelection selection)
 {
     if (_currentMappingDetailsInfo != null)
     {
         _currentMappingDetailsInfo.SelectionSource = EntityMappingSelectionSource.ModelBrowser;
     }
     ProcessSelectionFromOtherWindows(selection);
 }
Example #2
0
        public override void DrawAppointment(System.Drawing.Graphics g, System.Drawing.Rectangle rect, Calendar.Appointment appointment, bool isSelected, System.Drawing.Rectangle gripRect)
        {
            if (appointment == null)
            {
                throw new ArgumentNullException("appointment");
            }

            if (g == null)
            {
                throw new ArgumentNullException("g");
            }

            /*
             * Logic for drawing the appointment:
             * 1) Do something messy with the colours
             *
             * 2) Determine background pattern
             * 2.1) App is locked -> HatchBrush
             * 2.2) Normal app -> Nothing
             *
             * 3) Draw the background of appointment
             *
             * 4) Draw the edges of appointment
             * 4.1) If app is selected -> just draw the selection rectangle
             * 4.2) If not -> draw the gripper, border (if required) and shadows
             */

            if (rect.Width != 0 && rect.Height != 0)
            {
                rect.Width--;

                using (StringFormat format = new StringFormat())
                {
                    format.Alignment     = StringAlignment.Near;
                    format.LineAlignment = StringAlignment.Near;

                    // Draw the background of the appointment
                    if (isSelected)
                    {
                        g.FillRectangle(System.Drawing.Brushes.White, rect);
                        ExplorerSelection.DrawBackground(g, rect);
                        ExplorerSelection.DrawBackground(g, rect);
                    }
                    else
                    {
                        using (SolidBrush brush = new SolidBrush(appointment.FillColor))
                            g.FillRectangle(brush, rect);
                    }

                    // Draw gripper bar
                    gripRect = rect;
                    gripRect.Inflate(-2, -2);
                    gripRect.Width = 5;
                    gripRect.Height--;

                    using (SolidBrush brush = new SolidBrush(appointment.BarColor))
                        g.FillRectangle(brush, gripRect);

                    // Draw gripper border
                    using (Pen m_Pen = new Pen(ColorUtil.DarkerDrawing(appointment.BarColor, 0.5f), 1))
                        g.DrawRectangle(m_Pen, gripRect);

                    //  Draw appointment border if needed
                    if (!isSelected && appointment.DrawBorder)
                    {
                        using (Pen pen = new Pen(appointment.BorderColor, 1))
                            g.DrawRectangle(pen, rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
                    }

                    // draw appointment text
                    rect.X = gripRect.Right /* + 2*/;
                    rect.Y++;

                    g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

                    Color textColor = (isSelected ? ColorUtil.DarkerDrawing(appointment.TextColor, 0.5f) : appointment.TextColor);

                    using (SolidBrush brush = new SolidBrush(textColor))
                        g.DrawString(appointment.Title, this.BaseFont, brush, rect, format);

                    g.TextRenderingHint = TextRenderingHint.SystemDefault;
                }
            }
        }