Exemplo n.º 1
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs structure contained event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            // Let base class do the standard stuff first
            base.OnPaint(e);

            if (_statusPanel != null)
            {
                PanelBorder border = _statusPanel.PanelBorder;

                // Paint border according to requested style
                switch (border)
                {
                case PanelBorder.Sunken:
                    if ((_parent.Style == VisualStyle.Office2003) || (_parent.Style == VisualStyle.IDE2005))
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, _parent.ColorDetails.MenuSeparatorColor, ButtonBorderStyle.Inset);
                    }
                    else
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Light(BackColor), ButtonBorderStyle.Inset);
                    }
                    break;

                case PanelBorder.Raised:
                    if ((_parent.Style == VisualStyle.Office2003) || (_parent.Style == VisualStyle.IDE2005))
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, _parent.ColorDetails.MenuSeparatorColor, ButtonBorderStyle.Outset);
                    }
                    else
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Light(BackColor), ButtonBorderStyle.Outset);
                    }
                    break;

                case PanelBorder.Dotted:
                    if (_parent.Style == VisualStyle.IDE)
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Light(ControlPaint.Dark(BackColor)), ButtonBorderStyle.Dotted);
                    }
                    else if ((_parent.Style == VisualStyle.Office2003) || (_parent.Style == VisualStyle.IDE2005))
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, _parent.ColorDetails.MenuSeparatorColor, ButtonBorderStyle.Dotted);
                    }
                    else
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Dark(BackColor), ButtonBorderStyle.Dotted);
                    }
                    break;

                case PanelBorder.Dashed:
                    if (_parent.Style == VisualStyle.IDE)
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Light(ControlPaint.Dark(BackColor)), ButtonBorderStyle.Dashed);
                    }
                    else if ((_parent.Style == VisualStyle.Office2003) || (_parent.Style == VisualStyle.IDE2005))
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, _parent.ColorDetails.MenuSeparatorColor, ButtonBorderStyle.Dashed);
                    }
                    else
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Dark(BackColor), ButtonBorderStyle.Dashed);
                    }
                    break;

                case PanelBorder.Solid:
                    if (_parent.Style == VisualStyle.IDE)
                    {
                        using (Pen borderPen = new Pen(ControlPaint.Light(ControlPaint.Dark(BackColor))))
                            e.Graphics.DrawRectangle(borderPen, 0, 0, Width - 1, Height - 1);
                    }
                    else if ((_parent.Style == VisualStyle.Office2003) || (_parent.Style == VisualStyle.IDE2005))
                    {
                        using (Pen borderPen = new Pen(_parent.ColorDetails.MenuSeparatorColor))
                            e.Graphics.DrawRectangle(borderPen, 0, 0, Width - 1, Height - 1);
                    }
                    else
                    {
                        ControlPaint.DrawBorder(e.Graphics, ClientRectangle, ControlPaint.Dark(BackColor), ButtonBorderStyle.Solid);
                    }
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void SetDay(DateTime now, bool today, List <MED_DAILY_SCHEDULE> list)
        {
            currentDay = now;
            toDay      = today;
            data       = list;

            this.labTitle.Visible = false;
            if (today)
            {
                this.labDay.Image = Resources.day1;
                this.labDay.Text  = "";
                if (list != null && list.Count > 0)
                {
                    this.labTitle.Text    = string.Format("代办事项{0}项", list.Count);
                    this.labTitle.Visible = true;
                }
            }
            else if (list != null && list.Count > 0)
            {
                this.labDay.Image     = Resources.day2;
                this.labDay.Text      = now.Day.ToString();
                this.labDay.ForeColor = Color.White;

                this.labTitle.Text    = string.Format("代办事项{0}项", list.Count);
                this.labTitle.Visible = true;
            }
            else
            {
                this.labDay.Image     = null;
                this.labDay.Text      = now.Day.ToString();
                this.labDay.ForeColor = Color.Black;
            }

            PanelBorder p   = null;
            Label       lab = null;

            for (int i = 0; i < this.panelNoFlash2.Controls.Count || list != null && i < list.Count; i++)
            {
                if (i < panelTmpList.Count)
                {
                    p   = panelTmpList[i] as PanelBorder;
                    lab = p.Controls[0] as Label;
                }
                else
                {
                    p = new PanelBorder()
                    {
                        Height = 26
                    };
                    p.Padding     = new Padding(6);
                    p.DashStyle   = DashStyle.Custom;
                    p.DashPattern = new float[] { 1f, 3f };
                    panelTmpList.Add(p);
                    this.panelNoFlash2.Controls.Add(p);
                    p.Dock = DockStyle.Top;

                    lab = new Label();
                    p.Controls.Add(lab);
                    lab.Dock       = DockStyle.Fill;
                    lab.ImageAlign = ContentAlignment.MiddleLeft;
                    lab.TextAlign  = ContentAlignment.MiddleLeft;

                    p.Tag            = i;
                    lab.Tag          = i;
                    lab.DoubleClick += (sender, e) =>
                    {
                        EditSchedule view = new EditSchedule(currentDay, ExtendApplicationContext.Current.LoginUser.LOGIN_NAME);
                        view.Edit(list[(int)(sender as Control).Tag]);
                        DialogHostFormPC pc = new DialogHostFormPC("编辑事项", view.Width, view.Height);
                        pc.Child = view;
                        pc.ShowDialog();
                        SetDay(now, today, list);
                    };
                }
                p.BringToFront();

                if (list != null && i < list.Count)
                {
                    var tmp = list[i];
                    if (tmp.STATE == 0)
                    {
                        p.BorderColor = UN_FINISHED_COLOR;
                        p.BackColor   = UN_FINISHED_COLOR;
                        lab.Image     = Resources.unfinished;
                    }
                    else
                    {
                        p.BorderColor = FINISHED_COLOR;
                        p.BorderColor = FINISHED_COLOR;
                        p.BackColor   = FINISHED_COLOR;
                        lab.Image     = Resources.finished;
                    }
                    lab.Text = string.Format("    {0} {1}", tmp.CREATE_DATE.Value.ToString("HH:mm"), tmp.CONTENT);
                }
                else
                {
                    p.Visible = false;
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Resets the PanelBorder property to its default value.
 /// </summary>
 public void ResetPanelBorder()
 {
     PanelBorder = PanelBorder.Solid;
 }