Ejemplo n.º 1
0
        public void CopyIntoTest()
        {
            IRulerInfo source = new RulerInfo
            {
                Width       = 500,
                Height      = 80,
                Opacity     = 0.90,
                ShowToolTip = true,
                IsLocked    = true,
                IsVertical  = true,
                TopMost     = true
            };

            IRulerInfo target = new RulerInfo
            {
                Width       = 400,
                Height      = 75,
                Opacity     = 0.60,
                ShowToolTip = true,
                IsLocked    = false,
                IsVertical  = false,
                TopMost     = true
            };

            RulerInfo.CopyInto(source, target);

            var properties = Helper.GetPublicPropertiesFromInterface(typeof(IRulerInfo));

            foreach (PropertyInfo pi in properties)
            {
                Assert.AreEqual(pi.GetValue(source), pi.GetValue(target));
            }
        }
Ejemplo n.º 2
0
        public static RulerInfo GetDefaultRulerInfo()
        {
            RulerInfo rulerInfo = new RulerInfo
            {
                Width       = 400,
                Height      = 75,
                Opacity     = 0.60,
                ShowToolTip = true,
                IsLocked    = false,
                IsVertical  = false,
                TopMost     = true
            };

            return(rulerInfo);
        }
Ejemplo n.º 3
0
		private void Init(RulerInfo rulerInfo)
		{
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.UpdateStyles();

			ResourceManager resources = new ResourceManager(typeof(MainForm));
			this.Icon = ((Icon)(resources.GetObject("$this.Icon")));

			this.SetUpMenu();

			this.Text = "Ruler";
			this.BackColor = Color.White;

			rulerInfo.CopyInto(this);

			this.FormBorderStyle = FormBorderStyle.None;

			this.ContextMenu = _menu;
			this.Font = new Font("Tahoma", 10);

			this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
		}
Ejemplo n.º 4
0
        public static RulerInfo CovertToRulerInfo(string[] args)
        {
            string width       = args[0];
            string height      = args[1];
            string isVertical  = args[2];
            string opacity     = args[3];
            string showToolTip = args[4];
            string isLocked    = args[5];
            string topMost     = args[6];

            RulerInfo rulerInfo = new RulerInfo
            {
                Width       = int.Parse(width),
                Height      = int.Parse(height),
                IsVertical  = bool.Parse(isVertical),
                Opacity     = double.Parse(opacity),
                ShowToolTip = bool.Parse(showToolTip),
                IsLocked    = bool.Parse(isLocked),
                TopMost     = bool.Parse(topMost)
            };

            return(rulerInfo);
        }
Ejemplo n.º 5
0
        private void Init(RulerInfo rulerInfo)
        {
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.UpdateStyles();

            ResourceManager resources = new ResourceManager(typeof(MainForm));
            this.Icon = ((Icon)(resources.GetObject("$this.Icon")));

            this.SetUpMenu();

            this.Text = "Ruler";
            this.BackColor = Color.White;

            rulerInfo.CopyInto(this);

            this.FormBorderStyle = FormBorderStyle.None;

            this.ContextMenu = _menu;
            this.Font = new Font("Tahoma", 10);

            this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

            MouseDoubleClick += (sender, args) =>
                { IsVertical = !IsVertical; };

            _toolTipMenuItem.Checked = true;
            this._toolTip.AutoPopDelay = 9999;
        }
Ejemplo n.º 6
0
 public MainForm(RulerInfo rulerInfo)
 {
     this.Init(rulerInfo);
 }
Ejemplo n.º 7
0
        private RulerInfo GetRulerInfo()
        {
            RulerInfo rulerInfo = new RulerInfo();

            this.CopyInto(rulerInfo);

            return rulerInfo;
        }
Ejemplo n.º 8
0
 public void GetDefaultRulerInfoTest()
 {
     Assert.AreNotEqual(null, RulerInfo.GetDefaultRulerInfo());
 }