Beispiel #1
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Creates the NumberEntry and ValueBar for this slider.
        /// </summary>
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            Point fieldPos;

            if (!string.IsNullOrEmpty(Label))
            {
                labelRect = new Rect(1, 1, Label.Length + 1, 1);
                fieldPos  = new Point(Label.Length + 2, 1);
            }
            else
            {
                fieldPos = new Point(1, 1);
            }

            int  fieldWidth = NumberEntryTemplate.CalculateFieldWidth(MaximumValue, MinimumValue);
            Size fieldSize  = new Size(fieldWidth, 1);

            fieldRect = new Rect(fieldPos, fieldSize);

            if (BarPigment == null)
            {
                BarPigment = DetermineMainPigment();
            }

            numEntry = new NumberEntry(new NumberEntryTemplate()
            {
                HasFrameBorder    = false,
                MinimumValue      = this.MinimumValue,
                MaximumValue      = this.MaximumValue,
                StartingValue     = CurrentValue,
                CommitOnLostFocus = true,
                ReplaceOnFirstKey = true,
                UpperLeftPos      = this.LocalToScreen(fieldRect.UpperLeft)
            });

            valueBar = new ValueBar(new ValueBarTemplate()
            {
                UpperLeftPos  = this.LocalToScreen(new Point(1, 2)),
                Width         = this.Size.Width - 4,
                MaximumValue  = this.MaximumValue,
                MinimumValue  = this.MinimumValue,
                StartingValue = this.CurrentValue,
                BarPigment    = this.BarPigment
            });

            ParentWindow.AddControls(valueBar, numEntry);

            numEntry.EntryChanged += new EventHandler(numEntry_EntryChanged);

            valueBar.MouseMoved += new EventHandler <MouseEventArgs>(valueBar_MouseMoved);

            valueBar.MouseButtonDown += new EventHandler <MouseEventArgs>(valueBar_MouseButtonDown);
        }
Beispiel #2
0
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Creates the NumberEntry and ValueBar for this slider.
        /// </summary>
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            Point fieldPos;
            if (!string.IsNullOrEmpty(Label))
            {
                labelRect = new Rect(1, 1, Label.Length + 1, 1);
                fieldPos = new Point(Label.Length + 2, 1);
            }
            else
            {
                fieldPos = new Point(1, 1);
            }

            int fieldWidth = NumberEntryTemplate.CalculateFieldWidth(MaximumValue, MinimumValue);
            Size fieldSize = new Size(fieldWidth, 1);
            fieldRect = new Rect(fieldPos, fieldSize);

            if (BarPigment == null)
                BarPigment = DetermineMainPigment();

            numEntry = new NumberEntry(new NumberEntryTemplate()
            {
                HasFrameBorder = false,
                MinimumValue = this.MinimumValue,
                MaximumValue = this.MaximumValue,
                StartingValue = CurrentValue,
                CommitOnLostFocus = true,
                ReplaceOnFirstKey = true,
                UpperLeftPos = this.LocalToScreen(fieldRect.UpperLeft)
            });

            valueBar = new ValueBar(new ValueBarTemplate()
            {
                UpperLeftPos = this.LocalToScreen(new Point(1,2)),
                Width = this.Size.Width-4,
                MaximumValue = this.MaximumValue,
                MinimumValue = this.MinimumValue,
                StartingValue = this.CurrentValue,
                BarPigment = this.BarPigment
            });

            ParentWindow.AddControls(valueBar, numEntry);

            numEntry.EntryChanged += new EventHandler(numEntry_EntryChanged);

            valueBar.MouseMoved += new EventHandler<MouseEventArgs>(valueBar_MouseMoved);

            valueBar.MouseButtonDown += new EventHandler<MouseEventArgs>(valueBar_MouseButtonDown);
        }
Beispiel #3
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            Color yellow = Color.DARK_AMBER;
            Color blue = Color.BLUE;

            CheckBox cb1 = new CheckBox(new CheckBoxTemplate()
            {
                UpperLeftPos = new Point(1,1),
                Label = yellow.DoForegroundCode() + " A check" + blue.DoBackgroundCode() + "box",
                MinimumWidth = 13,
                HasFrameBorder = false,
                //LabelAlignment = HorizontalAlignment.Center,
                Tooltip = "Testing" + blue.DoBackgroundCode() + " Tootlip"
            });

            Button b1 = new Button(new ButtonTemplate()
            {
                UpperLeftPos = new Point(1,2),
                Label = yellow.DoForegroundCode() + "A " + blue.DoBackgroundCode()+ "button",
                MinimumWidth = 11,
                LabelAlignment = HorizontalAlignment.Center
            });

            CheckBox cb3 = new CheckBox(new CheckBoxTemplate()
            {
                UpperLeftPos = new Point(1, 5),
                Label = yellow.DoForegroundCode() + "che" +
                    Color.StopColorCode + "cbox 3",
                AutoSizeOverride = new Size(5,3),
                HasFrameBorder = false,
                LabelAlignment = HorizontalAlignment.Center,
                CheckOnLeft = false,
            });

            CheckBox cb4 = new CheckBox(new CheckBoxTemplate()
            {
                UpperLeftPos = new Point(1, 7),
                Label = "check4",
                HasFrameBorder = false,
                AutoSizeOverride = new Size(11, 1),
                LabelAlignment = HorizontalAlignment.Center,
                CheckOnLeft = false,
            });

            ValueBar vb = new ValueBar(new ValueBarTemplate()
            {
                UpperLeftPos = new Point(1,12),
                MaximumValue = 100,
                StartingValue = 50,
                MinimumBGIntensity = .3f,
                MinimumFGIntensity = .5f,
                Width = 15,
                Tooltip = "Testing Tooltip"
            });

            Pigment p = new Pigment(0xffffff, 0x334455);

            AddControls(cb3);

            AddSchedule(new Schedule(Callback, 2));
        }