Example #1
0
 public TekFieldView() : base()
 {
     this.SetStyle(ControlStyles.UserPaint, true);
     Borders = new TekBorderStyle[(int)TekBorder.bdLast];
     for (int b = 0; b <= (int)TekBorder.bdTop; b++)
     {
         Borders[b] = TekBorderStyle.tbsNone;
     }
     NormalColor        = Color.AliceBlue;
     SelectedColor      = Color.YellowGreen;
     MultiSelectedColor = Color.DarkBlue;
 }
Example #2
0
 private void DrawBorderType(PaintEventArgs e, TekBorderStyle BS)
 {
     for (TekBorder border = TekBorder.bdTop; border < TekBorder.bdLast; border++)
     {
         if (IsSelected)
         {
             DrawSingleBorder(e, border, TekBorderStyle.tbsSelected);
         }
         else if (Borders[(int)border] == BS)
         {
             DrawSingleBorder(e, border, BS);
         }
     }
 }
Example #3
0
        private void DrawSingleBorder(PaintEventArgs e, TekBorder border, TekBorderStyle BS)
        {
            //tbsNone, tbsInternal, tbsExternal, tbsBoard, tbsSelected, tbsHighlight
            int[] penSizes = { 0, 1, 1, 1, 1, 2 };
            int   iBS      = (int)BS;
            int   iBorder  = (int)border;

            System.Drawing.Color[] bColors = { Color.White, Color.DarkGray, Color.Black, Color.Black, Color.AntiqueWhite, Color.Lime };

            int pensize = penSizes[iBS];


            int[] X1 = { 0, e.ClipRectangle.Width - 1, e.ClipRectangle.Width - 1, 0 };
            int[] X2 = { e.ClipRectangle.Width - 1, e.ClipRectangle.Width - 1, 0, 0 };
            int[] Y1 = { 0, 0, e.ClipRectangle.Height - 1, e.ClipRectangle.Height - 1 };
            int[] Y2 = { 0, e.ClipRectangle.Height - 1, e.ClipRectangle.Height - 1, 0 };
            if (pensize > 1)
            {
                int pensize2 = pensize / 2;
                switch (border)
                {
                case TekBorder.bdTop:
                    Y1[iBorder] += pensize2; Y2[iBorder] += pensize2;
                    break;

                case TekBorder.bdLeft:
                    X1[iBorder] += pensize2; X2[iBorder] += pensize2;
                    break;
                }
            }
            Pen pen = new Pen(new SolidBrush(bColors[iBS]), pensize);

            if (BS == TekBorderStyle.tbsHighlight)
            {
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            }
            e.Graphics.DrawLine(pen, X1[iBorder], Y1[iBorder], X2[iBorder], Y2[iBorder]);
        }