Example #1
0
 public BorderOptions(IBorderOptions iborderOptions_0)
 {
     this.borderSides_0 = iborderOptions_0.Sides;
     this.borderline_0  = iborderOptions_0.LineStyle;
     this.Weight        = iborderOptions_0.Weight;
     this.Color         = iborderOptions_0.Color;
 }
Example #2
0
 public BorderOptions()
 {
     this.borderSides_0 = BorderSides.None;
     this.borderline_0  = Borderline.Continuous;
     this.Weight        = 1;
     this.Color         = System.Drawing.Color.Black;
 }
Example #3
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public BorderOptions()
 {
     sides     = BorderSides.None;
     lineStyle = Borderline.Continuous;
     Weight    = 1;
     Color     = Color.Black;
 }
Example #4
0
 /// <summary>
 /// Creates a new instance based on another instance
 /// </summary>
 /// <param name="borderOptions">Instance to copy</param>
 public BorderOptions(IBorderOptions borderOptions)
 {
     sides     = borderOptions.Sides;
     lineStyle = borderOptions.LineStyle;
     Weight    = borderOptions.Weight;
     Color     = borderOptions.Color;
 }
Example #5
0
 private static void Main(string[] args)
 {
     for (int i = 0; i <= 16; i++)
     {
         BorderSides side = (BorderSides)i;
         Console.WriteLine(IsFlagDefined(side) + " " + side);
     }
 }
Example #6
0
 public static void Case0()
 {
     for (int i = 0; i <= 32; i++)
     {
         BorderSides side = (BorderSides)i;
         Console.WriteLine(IsFlagDefined(side) + " [" + side + "], " + side.ToString());
     }
 }
Example #7
0
 private bool Match(BorderSides sides, bool xmin, bool xmax, bool ymin, bool ymax, bool zmin, bool zmax)
 {
     return
         (xmin && sides.HasFlag(BorderSides.XMin) ||
          xmax && sides.HasFlag(BorderSides.XMax) ||
          ymin && sides.HasFlag(BorderSides.YMin) ||
          ymax && sides.HasFlag(BorderSides.YMax) ||
          zmin && sides.HasFlag(BorderSides.ZMin) ||
          zmax && sides.HasFlag(BorderSides.ZMax));
 }
Example #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Paints the background of the specified control using the data entry background
        /// color scheme.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public static void PaintDataEntryBackground(Graphics g, Rectangle rc, BorderSides sides)
        {
            if (MainWnd.Resizing)
            {
                return;
            }

            using (var br = new LinearGradientBrush(rc, DataEntryPanelBegin, DataEntryPanelEnd, 45f))
                g.FillRectangle(br, rc);

            PaintDataEntryBorder(g, rc, sides);
        }
Example #9
0
        private static void EnumExample()
        {
            BorderSides leftRight = BorderSides.Left | BorderSides.Right;

            if ((leftRight & BorderSides.Left) != 0)
            {
                WriteLine("Includes Left");          //Includes Left
            }
            string formatted = leftRight.ToString(); //"Left, Right"

            BorderSides s = BorderSides.Left;

            s |= BorderSides.Right;
            WriteLine(s == leftRight); //true

            s ^= BorderSides.Right;    //Toggles BorderSides.Right
            WriteLine(s);
        }
Example #10
0
    // Start is called before the first frame update
    void Start()
    {
        int right_v1  = (int)BorderSide_v1.Right;
        int bottom_v1 = (int)BorderSide_v1.Bottom;

        Debug.Log($"right_v1:{right_v1}");
        Debug.Log($"bottom_v1:{bottom_v1}");


        BorderSides leftRight = BorderSides.Left | BorderSides.Right;

        if ((leftRight & BorderSides.Left) != 0)
        {
            Debug.Log("leftRight 包含 Left");
        }

        string formatted = leftRight.ToString(); //声明为Flags,打印结果为:Left, Right

        Debug.Log(formatted);

        BorderSides side      = (BorderSides)12345;
        bool        isDefined = Enum.IsDefined(typeof(BorderSides), side);

        Debug.Log($" {side} is defined? {isDefined}");

        var name = Enum.GetName(typeof(BorderSides), BorderSides.Bottom);

        Debug.Log(name);
        var names = Enum.GetNames(typeof(BorderSides));

        Debug.Log(string.Concat(names));


        Colors r = (Colors)Enum.Parse(typeof(Colors), "Red");

        if (r == Colors.Red)
        {
            Debug.Log("Success");
        }

        Debug.Log(BorderSides.Bottom.ToString());
    }
Example #11
0
        public void WriteBorder(Symbol borderSymbol, BorderSides sides)
        {
            if ((sides & BorderSides.Rigth) == BorderSides.Rigth)
            {
                WriteRightBorder(borderSymbol);
            }
            if ((sides & BorderSides.Left) == BorderSides.Left)
            {
                WriteLeftBorder(borderSymbol);
            }

            if ((sides & BorderSides.Top) == BorderSides.Top)
            {
                WriteTopBorder(borderSymbol);
            }
            if ((sides & BorderSides.Bottom) == BorderSides.Bottom)
            {
                WriteBottomBorder(borderSymbol);
            }
        }
Example #12
0
        static void Main(string[] args)
        {
            BorderSides leftRight = BorderSides.Left | BorderSides.Right;

            if ((leftRight & BorderSides.Left) != 0)
            {
                Console.WriteLine("Includes Left");  //Includes Left
            }
            string formatted = leftRight.ToString(); //Left,Right

            Console.WriteLine(formatted);            //Left,Right

            BorderSides s = BorderSides.Left;

            s |= BorderSides.Right;
            Console.WriteLine(s == leftRight);    //True

            //切换BorderSides.Right
            s ^= BorderSides.Right;
            Console.WriteLine(s);   //Left
        }
Example #13
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Paint borders in the specified rectangle using the specified color.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public static void PaintBorder(Graphics g, Color clr, Rectangle rc, BorderSides sides)
        {
            if (sides == BorderSides.None || MainWnd.Resizing)
            {
                return;
            }

            using (var pen = new Pen(clr))
            {
                rc.Width--;
                rc.Height--;

                if (sides == BorderSides.All)
                {
                    g.DrawRectangle(pen, rc);
                    return;
                }

                if ((sides & BorderSides.Left) == BorderSides.Left)
                {
                    g.DrawLine(pen, rc.Location, new Point(rc.Left, rc.Bottom));
                }

                if ((sides & BorderSides.Top) == BorderSides.Top)
                {
                    g.DrawLine(pen, rc.Location, new Point(rc.Right, rc.Top));
                }

                if ((sides & BorderSides.Right) == BorderSides.Right)
                {
                    g.DrawLine(pen, new Point(rc.Right, rc.Top), new Point(rc.Right, rc.Bottom));
                }

                if ((sides & BorderSides.Bottom) == BorderSides.Bottom)
                {
                    g.DrawLine(pen, new Point(rc.Left, rc.Bottom), new Point(rc.Right, rc.Bottom));
                }
            }
        }
Example #14
0
 public BorderedSection(Section section, Symbol borderSymbol, BorderSides sides = BorderSides.All) :
     this(section.PinY, section.PinX, section.Height, section.Width, section.Layer, borderSymbol, sides)
 {
 }
Example #15
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Paint borders in the specified rectangle using the border color for the data
 /// entry color scheme.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public static void PaintDataEntryBorder(Graphics g, Rectangle rc, BorderSides sides)
 {
     PaintBorder(g, DataEntryPanelBorder, rc, sides);
 }
        private static void MiscTest()
        {
            string s1 = null;
            string s2 = s1 ?? "nothing"; // s2 evaluates to "nothing"

            System.Text.StringBuilder sb = null;
            string s = sb?.ToString().ToUpper(); // No error
            // Equivalent: string s = (sb == null ? null : sb.ToString());
            // x?.y?.z
            int?length = sb?.ToString().Length; // OK : int? can be null

            s = sb?.ToString() ?? "nothing";    // s evaluates to "nothing"
            foreach (char c in "beer")
            {
                Console.WriteLine(c + " "); // b e e r
            }
            System.Security.Cryptography.RSA rsa = System.Security.Cryptography.RSA.Create();

            int    x   = 9;
            object obj = x;                  // Box the int
            int    y   = (int)obj;           // Unbox the int

            object obj2 = 9;                 // 9 is inferred to be of type int
            //long x2 = (long)obj2; // InvalidCastException
            int    x2   = (int)obj2;         // OK
            object obj3 = 3.5;               // 3.5 inferred to be type double
            int    x3   = (int)(double)obj3; // x3 is now 3

            //int x4 = "5";    // Fail because the compiler enforces static typing
            object y4 = "5";
            //int z4 = (int)y4; // Runtime error, downcast failed

            // System.Type - GetType Method and typeof Operator
            // - GetType - runtime, on instance
            // - typeof - statically at compile time
            int x5 = 3;

            Console.WriteLine(x5.GetType().Name);           // Int32
            Console.WriteLine(typeof(int).Name);            // Int32
            Console.WriteLine(x5.GetType().FullName);       // System.Int32
            Console.WriteLine(x5.GetType() == typeof(int)); // True
            Console.WriteLine();

            // Enum
            BorderSide topSide     = BorderSide.Top;
            bool       isTop       = (topSide == BorderSide.Top);
            int        en          = (int)BorderSide.Left;
            BorderSide side        = (BorderSide)en;
            bool       leftOrRight = (int)side <= 2;

            BorderSides leftRight = BorderSides.Left | BorderSides.Right;

            if ((leftRight & BorderSides.Left) != 0)
            {
                Console.WriteLine("Includes Left");     // Includes Left
            }
            string formatted = leftRight.ToString();    // "Left, Right"

            BorderSides sx = BorderSides.Left;

            sx |= BorderSides.Right;
            Console.WriteLine(sx == leftRight);  // True

            Console.WriteLine("=====================================================================");
        }
Example #17
0
		/// <summary>
		/// Creates a new instance
		/// </summary>
		public BorderOptions()
		{
			sides = BorderSides.None;
			lineStyle = Borderline.Continuous;
			Weight = 1;
			Color = Color.Black;
		}
Example #18
0
		/// <summary>
		/// Creates a new instance based on another instance
		/// </summary>
		/// <param name="borderOptions">Instance to copy</param>
		public BorderOptions(IBorderOptions borderOptions)
		{
			sides = borderOptions.Sides;
			lineStyle = borderOptions.LineStyle;
			Weight = borderOptions.Weight;
			Color = borderOptions.Color;
		}
Example #19
0
 public BorderedSection(int pinY, int pinX, int height, int width, int layer, Symbol borderSymbol, BorderSides sides = BorderSides.All) : base(pinY, pinX, height, width, layer)
 {
     BorderSymbol = borderSymbol;
     Sides        = sides;
     WriteBorder(borderSymbol, sides);
 }