예제 #1
0
 public bitsBorder(StiBorderSides side, Color color, double size, StiPenStyle style, double shadowSize, bool dropShadow, bool topmost)
 {
     this.Side       = side;
     this.Color      = color;
     this.Size       = size;
     this.Style      = style;
     this.ShadowSize = shadowSize;
     this.DropShadow = dropShadow;
     this.Topmost    = topmost;
 }
예제 #2
0
 /// <summary>
 /// Creates a new instance of the StiBorder class.
 /// </summary>
 /// <param name="side">Border sides.</param>
 /// <param name="color">Border color.</param>
 /// <param name="size">Border size.</param>
 /// <param name="style">Border style.</param>
 /// <param name="dropShadow">Drop shadow or not.</param>
 /// <param name="shadowSize">Shadow size.</param>
 /// <param name="shadowBrush">Brush for drawing shadow of border.</param>
 /// <param name="topmost">Value which indicates that border sides will be drawn on top of all components.</param>
 public StiBorder(StiBorderSides side, Color color, double size, StiPenStyle style,
                  bool dropShadow, double shadowSize, StiBrush shadowBrush, bool topmost)
 {
     if (bitsBorder.IsDefault(side, color, size, style, dropShadow, shadowSize, topmost))
     {
         this.bits = null;
     }
     else
     {
         this.bits = new bitsBorder(side, color, size, style, shadowSize, dropShadow, topmost);
     }
     this.shadowBrush = shadowBrush;
 }
예제 #3
0
 /// <summary>
 /// Creates a new instance of the StiAdvancedBorder class.
 /// </summary>
 public StiAdvancedBorder(
     Color topSideColor, double topSideSize, StiPenStyle topSideStyle,
     Color bottomSideColor, double bottomSideSize, StiPenStyle bottomSideStyle,
     Color leftSideColor, double leftSideSize, StiPenStyle leftSideStyle,
     Color rightSideColor, double rightSideSize, StiPenStyle rightSideStyle,
     bool dropShadow, double shadowSize, StiBrush shadowBrush) :
     this(
         new StiBorderSide(topSideColor, topSideSize, topSideStyle),
         new StiBorderSide(bottomSideColor, bottomSideSize, bottomSideStyle),
         new StiBorderSide(leftSideColor, leftSideSize, leftSideStyle),
         new StiBorderSide(rightSideColor, rightSideSize, rightSideStyle),
         dropShadow, shadowSize, shadowBrush)
 {
 }
        public static DashStyle GetPenStyle(StiPenStyle penStyle)
        {
            switch (penStyle)
            {
            case StiPenStyle.Dash:
                return(DashStyle.Dash);

            case StiPenStyle.DashDot:
                return(DashStyle.DashDot);

            case StiPenStyle.DashDotDot:
                return(DashStyle.DashDotDot);

            case StiPenStyle.Dot:
                return(DashStyle.Dot);

            case StiPenStyle.Double:
                return(DashStyle.Solid);

            default:
                return(DashStyle.Solid);
            }
        }
        private StiPenStyle GetPenStyle()
        {
            int         penPat   = GetInt("PENPAT");
            StiPenStyle penStyle = StiPenStyle.None;

            switch (penPat)
            {
            case 0:
                penStyle = StiPenStyle.None;
                break;

            case 1:
            case 5:
            case 6:
            case 7:
                penStyle = StiPenStyle.Dot;
                break;

            case 2:
                penStyle = StiPenStyle.Dash;
                break;

            case 3:
                penStyle = StiPenStyle.DashDot;
                break;

            case 4:
                penStyle = StiPenStyle.DashDotDot;
                break;

            case 8:
                penStyle = StiPenStyle.Solid;
                break;
            }
            return(penStyle);
        }
예제 #6
0
        public static void DrawPenStyle(DrawItemEventArgs e)
        {
            Graphics  g          = e.Graphics;
            Rectangle rect       = e.Bounds;
            Rectangle borderRect = new Rectangle(rect.X + 2, rect.Y + 2, 52, 14);

            #region Fill
            rect.Width--;
            StiControlPaint.DrawItem(g, rect, e.State, SystemColors.Window, SystemColors.ControlText);
            #endregion

            #region Paint border style
            Array obj = Enum.GetValues(typeof(StiPenStyle));

            using (Pen pen = new Pen(Color.Black, 2))
            {
                StiPenStyle penStyle = StiPenStyle.Solid;
                if (e.Index != -1)
                {
                    penStyle = (StiPenStyle)obj.GetValue(e.Index);
                }
                pen.DashStyle = StiPenUtils.GetPenStyle(penStyle);

                g.FillRectangle(Brushes.White, borderRect);

                int center = rect.Top + rect.Height / 2;

                if (penStyle == StiPenStyle.Double)
                {
                    pen.Width = 1;
                    g.DrawLine(pen, 2, center - 1, 54, center - 1);
                    g.DrawLine(pen, 2, center + 1, 54, center + 1);
                }
                else if (penStyle != StiPenStyle.None)
                {
                    g.DrawLine(pen, 2, center, 54, center);
                }
            }

            g.DrawRectangle(Pens.Black, borderRect);
            #endregion

            #region Paint name
            using (Font font = new Font("Arial", 8))
            {
                using (StringFormat stringFormat = new StringFormat())
                {
                    stringFormat.LineAlignment = StringAlignment.Center;

                    string name = ((StiPenStyle)obj.GetValue(e.Index)).ToString();

                    string locName = StiLocalization.Get("PropertyEnum", "StiPenStyle" + name);

                    if (locName != null)
                    {
                        name = locName;
                    }

                    e.Graphics.DrawString(name,
                                          font, Brushes.Black,
                                          new Rectangle(55, rect.Top + 4, rect.Width - 18, 10),
                                          stringFormat);
                }
            }
            #endregion
        }
예제 #7
0
 /// <summary>
 /// Creates a new instance of the StiBorder class.
 /// </summary>
 /// <param name="side">Border sides.</param>
 /// <param name="color">Border color.</param>
 /// <param name="size">Border size.</param>
 /// <param name="style">Border style.</param>
 public StiBorder(StiBorderSides side, Color color, double size, StiPenStyle style)
     :
     this(side, color, size, style, false, 4d, new StiSolidBrush(Color.Black))
 {
 }
예제 #8
0
 public static bool IsDefault(StiBorderSides side, Color color, double size, StiPenStyle style, bool dropShadow, double shadowSize, bool topmost)
 {
     if (color == Color.Black &&
         (!dropShadow) &&
         (!topmost) &&
         shadowSize == 4d &&
         side == StiBorderSides.None &&
         size == 1d &&
         style == StiPenStyle.Solid)
     {
         return(true);
     }
     return(false);
 }
예제 #9
0
 /// <summary>
 /// Creates a new instance of the StiBorder class.
 /// </summary>
 /// <param name="side">Border sides.</param>
 /// <param name="color">Border color.</param>
 /// <param name="size">Border size.</param>
 /// <param name="style">Border style.</param>
 /// <param name="dropShadow">Drop shadow or not.</param>
 /// <param name="shadowSize">Shadow size.</param>
 /// <param name="shadowBrush">Brush for drawing shadow of border.</param>
 public StiBorder(StiBorderSides side, Color color, double size, StiPenStyle style,
                  bool dropShadow, double shadowSize, StiBrush shadowBrush) :
     this(side, color, size, style, dropShadow, shadowSize, shadowBrush, false)
 {
 }
 /// <summary>
 /// Creates a new instance of the StiBorderSide class.
 /// </summary>
 /// <param name="color">Border color.</param>
 /// <param name="size">Border size.</param>
 /// <param name="style">Border style.</param>
 public StiBorderSide(Color color, double size, StiPenStyle style)
 {
     this.color = color;
     this.size  = size;
     this.style = style;
 }