Ejemplo n.º 1
0
 ///<summary>During mouse down, this is used to send a different size bitmap for dragging around.</summary>
 public void SetBitmapTempPinAppt(Bitmap bitmap)
 {
     if (bitmap == null)          //ContrAppt is telling pinboard that we can't drag appt off.
     {
         _bitmapTempPinAppt = null;
         return;
     }
     _bitmapTempPinAppt    = new Bitmap(bitmap);
     contrTempPinAppt.Size = new Size(_bitmapTempPinAppt.Width, _bitmapTempPinAppt.Height);
     //Next line rounds the corners of the control so that they are invisible
     contrTempPinAppt.Region = new Region(ContrApptPanel.GetRoundedPath(new RectangleF(0, 0, contrTempPinAppt.Width, contrTempPinAppt.Height), 2));
 }
Ejemplo n.º 2
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            Graphics g = pe.Graphics;

            g.Clear(Color.White);
            g.SmoothingMode = SmoothingMode.HighQuality;
            g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1);
            //for(int i=0;i<_dataTableAppointments.Rows.Count;i++) {
            if (ListPinBoardItems == null || ListPinBoardItems.Count == 0)
            {
                StringFormat format = new StringFormat();
                format.Alignment     = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;
                g.DrawString("Drag Appointments to this Pinboard", Font, Brushes.Gray, new RectangleF(0, 0, Width, Height - 20), format);
                return;
            }
            for (int i = 0; i < ListPinBoardItems.Count; i++)
            {
                int locY = i * 13;
                g.DrawImage(ListPinBoardItems[i].BitmapAppt, 1, locY);
                if (_selectedIndex == i)
                {
                    DataRow dataRow = ListPinBoardItems[i].DataRowAppt;
                    Pen     penProvOutline;
                    if (dataRow["ProvNum"].ToString() != "0" && dataRow["IsHygiene"].ToString() == "0")                 //dentist
                    {
                        penProvOutline = new Pen(Providers.GetOutlineColor(PIn.Long(dataRow["ProvNum"].ToString())), 3f);
                    }
                    else if (dataRow["ProvHyg"].ToString() != "0" && dataRow["IsHygiene"].ToString() == "1")                 //hygienist
                    {
                        penProvOutline = new Pen(Providers.GetOutlineColor(PIn.Long(dataRow["ProvHyg"].ToString())), 3f);
                    }
                    else                                           //unknown
                    {
                        penProvOutline = new Pen(Color.Black, 3f); //Do not use Pens.Black because we will be disposing this pen later on.
                    }
                    GraphicsPath graphicsPathOutline = ContrApptPanel.GetRoundedPath(
                        new RectangleF(1.5f, locY + .5f, ListPinBoardItems[i].BitmapAppt.Width - 2, ListPinBoardItems[i].BitmapAppt.Height - 1.5f), 2);
                    g.DrawPath(penProvOutline, graphicsPathOutline);
                    //g.DrawRectangle(penProvOutline,1.5f,locY+.5f,ListPinBoardItems[i].BitmapAppt.Width-2,ListPinBoardItems[i].BitmapAppt.Height-1);
                    penProvOutline.Dispose();
                }
            }
        }
Ejemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
            Graphics g = pe.Graphics;          //alias

            g.SmoothingMode     = SmoothingMode.HighQuality;
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;          //keeps text centered in cells better
            using (SolidBrush brushBack = new SolidBrush(this.BackColor)){
                g.FillRectangle(brushBack, 0, 0, Width, Height);
            }
            g.FillRectangle(Brushes.White, _marginLR, 0, Width - _marginLR * 2 - 1, SelectedLength * _heightRow);
            //g.FillRectangle(Brushes.LightGray,_marginLR,0,_widthLeft,SelectedLength*_heightRow);//left handles
            //lines are drawn above each cell
            for (int i = 0; i < SelectedLength; i++)
            {
                if (MinPerIncr == 10)
                {
                    if (i * 2 < Pattern.Length && Pattern.Substring(i * 2, 1) == "X")
                    {
                        g.FillRectangle(_brushProv, _marginLR, i * _heightRow, _widthLeft, _heightRow);
                    }
                    if (i * 2 < PatternSecondary.Length && PatternSecondary.Substring(i * 2, 1) == "X")
                    {
                        g.FillRectangle(_brushProv2, _marginLR + _widthLeft, i * _heightRow, _widthLeft, _heightRow);
                    }
                    if (i % 6 == 0)
                    {
                        g.DrawLine(Pens.Black, _marginLR, i * _heightRow, Width - _marginLR - 1, i * _heightRow);
                    }
                    else
                    {
                        g.DrawLine(Pens.Silver, _marginLR, i * _heightRow, Width - _marginLR - 1, i * _heightRow);
                    }
                }
                else if (MinPerIncr == 15)
                {
                    if (i * 3 < Pattern.Length && Pattern.Substring(i * 3, 1) == "X")
                    {
                        g.FillRectangle(_brushProv, _marginLR, i * _heightRow, _widthLeft, _heightRow);
                    }
                    if (i * 3 < PatternSecondary.Length && PatternSecondary.Substring(i * 3, 1) == "X")
                    {
                        g.FillRectangle(_brushProv2, _marginLR + _widthLeft, i * _heightRow, _widthLeft, _heightRow);
                    }
                    if (i % 4 == 0)
                    {
                        g.DrawLine(Pens.Black, _marginLR, i * _heightRow, Width - _marginLR - 1, i * _heightRow);
                    }
                    else
                    {
                        g.DrawLine(Pens.Silver, _marginLR, i * _heightRow, Width - _marginLR - 1, i * _heightRow);
                    }
                }
                else                 //5
                {
                    if (i * 1 < Pattern.Length && Pattern.Substring(i * 1, 1) == "X")
                    {
                        g.FillRectangle(_brushProv, _marginLR, i * _heightRow, _widthLeft, _heightRow);
                    }
                    if (i * 1 < PatternSecondary.Length && PatternSecondary.Substring(i * 1, 1) == "X")
                    {
                        g.FillRectangle(_brushProv2, _marginLR + _widthLeft, i * _heightRow, _widthLeft, _heightRow);
                    }
                    if (i % 12 == 0)
                    {
                        g.DrawLine(Pens.Black, _marginLR, i * _heightRow, Width - _marginLR - 1, i * _heightRow);
                    }
                    else
                    {
                        g.DrawLine(Pens.Silver, _marginLR, i * _heightRow, Width - _marginLR - 1, i * _heightRow);
                    }
                }
            }
            //ProvBarText-------------------------------------------------------------------------------
            //needs to be a second loop due to descending characters like g that need to draw on top of gridlines
            for (int i = 0; i < SelectedLength; i++)
            {
                if (_provBarText.Length > i && _provBarText[i] != ' ')
                {
                    //float widthChar=g.MeasureString(ProvBarText.Substring(i,1),Font).Width;
                    //float xCenter=_marginLR+_widthLeft+(Width-_marginLR*2f-_widthLeft)/2f;
                    //g.DrawString(ProvBarText.Substring(i,1),_fontCourier,Brushes.Black,xCenter-widthChar/2f,i*_heightRow+1);
                    g.DrawString(_provBarText.Substring(i, 1), _fontCourier, Brushes.Black, _marginLR + (_widthLeft * 2) + 1, i * _heightRow + 1);
                }
            }
            //outline-----------------------------------------------------------------------------------
            g.DrawLine(Pens.Silver, _marginLR + _widthLeft, 0, _marginLR + _widthLeft, SelectedLength * _heightRow);             //first vertical line closer to L
            g.DrawLine(Pens.Silver, _marginLR + (_widthLeft * 2), 0, _marginLR + (_widthLeft * 2), SelectedLength * _heightRow); //second vertical line closer to R
            g.DrawLine(Pens.Gray, _marginLR, 0, Width - _marginLR - 1, 0);                                                       //top
            g.DrawLine(Pens.Gray, _marginLR, 0, _marginLR, SelectedLength * _heightRow);                                         //L above slider
            g.DrawLine(Pens.Gray, Width - _marginLR - 1, 0, Width - _marginLR - 1, SelectedLength * _heightRow);                 //R above slider
            if (DesignMode)
            {
                g.DrawLine(Pens.LightGray, _marginLR, Height - 1, Width - _marginLR - 1, Height - 1);                          //bottom
                g.DrawLine(Pens.LightGray, _marginLR, SelectedLength * _heightRow, _marginLR, Height);                         //L below slider
                g.DrawLine(Pens.LightGray, Width - _marginLR - 1, SelectedLength * _heightRow, Width - _marginLR - 1, Height); //R below slider
            }
            //Slider------------------------------------------------------------------------------------
            _rectangleFSlider = new RectangleF(0, SelectedLength * _heightRow, Width - 1, _heightRow + 4);
            GraphicsPath graphicsPath = ContrApptPanel.GetRoundedPath(_rectangleFSlider, 2);

            if (_rectangleFSlider.Contains(_pointMouse) || _isDraggingSlider)
            {
                g.FillPath(Brushes.White, graphicsPath);               //hover effect
            }
            else
            {
                using (SolidBrush brush237 = new SolidBrush(Color.FromArgb(237, 237, 237))){
                    g.FillPath(brush237, graphicsPath);
                }
            }
            using (Pen pen = new Pen(_colorSliderOutline)){
                g.DrawPath(pen, graphicsPath);
            }
            TimeSpan timeSpan = TimeSpan.FromMinutes(Pattern.Length * 5);
            string   strTime  = timeSpan.ToString("h':'mm");

            g.DrawString(strTime, Font, Brushes.Black, 9, SelectedLength * _heightRow + 3);
            //SelectedIndex------------------------------------------------------------------------------
            if (SelectedIndex > -1 && _isCursorFlashOn && this.Focused)
            {
                g.DrawLine(Pens.Red, _marginLR + (_widthLeft * 2) + 3, SelectedIndex * _heightRow + 2, _marginLR + (_widthLeft * 2) + 3, SelectedIndex * _heightRow + 11);
            }
        }