private void AddHorizontalScrollbar(int top, int minimum, int maximum, int largeChange, int smallChange, int size = 300)
        {
            var desc_label = new Label {
                Left = 10,
                Top  = top,
                Text = $"{minimum} - {maximum}, {smallChange}, {largeChange}"
            };

            Controls.Add(desc_label);

            var sb = new HorizontalScrollBar {
                Left        = 120,
                Top         = top,
                Width       = size,
                Minimum     = minimum,
                Maximum     = maximum,
                LargeChange = largeChange,
                SmallChange = smallChange
            };

            Controls.Add(sb);

            var sb_label = new Label {
                Left = 440,
                Top  = top,
                Text = sb.Value.ToString()
            };

            sb.ValueChanged += (o, e) => sb_label.Text = sb.Value.ToString();

            Controls.Add(sb_label);
        }
示例#2
0
        protected override void InitializeChildren(IUIContext context)
        {
            base.InitializeChildren(context);

            HorizontalScrollBar?.Initialize(context);
            VerticalScrollBar?.Initialize(context);
        }
示例#3
0
        public void HorizontalScrollBarConstructorTest()
        {
            Vector2             topLeft = new Vector2(); // TODO: Initialize to an appropriate value
            float               width   = 0F;            // TODO: Initialize to an appropriate value
            HorizontalScrollBar target  = new HorizontalScrollBar(topLeft, width);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
示例#4
0
        public void DrawTest()
        {
            Vector2             topLeft = new Vector2();                           // TODO: Initialize to an appropriate value
            float               width   = 0F;                                      // TODO: Initialize to an appropriate value
            HorizontalScrollBar target  = new HorizontalScrollBar(topLeft, width); // TODO: Initialize to an appropriate value
            SpriteBatch         sb      = null;                                    // TODO: Initialize to an appropriate value

            target.Draw(sb);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
示例#5
0
        public void BoundBoxPartTest()
        {
            Vector2             topLeft = new Vector2();                           // TODO: Initialize to an appropriate value
            float               width   = 0F;                                      // TODO: Initialize to an appropriate value
            HorizontalScrollBar target  = new HorizontalScrollBar(topLeft, width); // TODO: Initialize to an appropriate value
            Rectangle           actual;

            actual = target.BoundBoxPart;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
示例#6
0
        public void setPositionTest()
        {
            Vector2             topLeft = new Vector2();                           // TODO: Initialize to an appropriate value
            float               width   = 0F;                                      // TODO: Initialize to an appropriate value
            HorizontalScrollBar target  = new HorizontalScrollBar(topLeft, width); // TODO: Initialize to an appropriate value
            Vector2             pos     = new Vector2();                           // TODO: Initialize to an appropriate value

            target.setPosition(pos);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
示例#7
0
        public void UpdateTest()
        {
            Vector2             topLeft = new Vector2();                           // TODO: Initialize to an appropriate value
            float               width   = 0F;                                      // TODO: Initialize to an appropriate value
            HorizontalScrollBar target  = new HorizontalScrollBar(topLeft, width); // TODO: Initialize to an appropriate value
            GameTime            time    = null;                                    // TODO: Initialize to an appropriate value

            target.Update(time);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            HorizontalScrollBar scroll = element.FlaUIElement.AsHorizontalScrollBar();

            scroll.ScrollLeft();

            return(this.JsonResponse());
        }
示例#9
0
        public void GetMaxTest()
        {
            Vector2             topLeft  = new Vector2();                           // TODO: Initialize to an appropriate value
            float               width    = 0F;                                      // TODO: Initialize to an appropriate value
            HorizontalScrollBar target   = new HorizontalScrollBar(topLeft, width); // TODO: Initialize to an appropriate value
            float               expected = 0F;                                      // TODO: Initialize to an appropriate value
            float               actual;

            actual = target.GetMax();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
 public void BringCtrlToFront(Control ctrl)
 {
     ctrl.BringToFront();
     if (HorizontalScrollBar.Visible)
     {
         HorizontalScrollBar.BringToFront();
     }
     if (VerticalScrollBar.Visible)
     {
         VerticalScrollBar.BringToFront();
     }
 }
示例#11
0
            public override void Add(Control value)
            {
                VerticalScrollBar vscrollbar = value as VerticalScrollBar;

                if (vscrollbar != null)
                {
                    ((ViewportContainer)Owner).verticalScrollBar = value;
                }
                HorizontalScrollBar hscrollbar = value as HorizontalScrollBar;

                if (hscrollbar != null)
                {
                    ((ViewportContainer)Owner).horizontalScrollBar = value;
                }
                base.Add(value);
            }
示例#12
0
        public ButtonForm()
        {
            var b = new Button {
                Text   = "OK",
                Left   = 100,
                Top    = 100,
                Width  = 100,
                Height = 30
            };

            Controls.Add(b);

            var b2 = new Button {
                Text = "OK",
                Left = 225,
                Top  = 100
            };

            b2.Style.BackgroundColor = SKColors.White;
            b2.Style.ForegroundColor = Theme.RibbonColor;
            b2.Style.Border.Width    = 3;
            b2.Style.Border.Color    = SKColors.Red;

            Controls.Add(b2);

            var b3 = new Button {
                Text = "OK",
                Left = 350,
                Top  = 100
            };

            b3.Style.BackgroundColor = new SKColor(243, 246, 248);
            b3.Style.Border.Color    = new SKColor(204, 206, 208);
            b3.Style.ForegroundColor = new SKColor(36, 41, 46);
            b3.Style.Border.Radius   = 3;
            b3.Style.Border.Width    = 1;

            b3.StyleHover.BackgroundColor = new SKColor(230, 235, 241);
            b3.StyleHover.Border.Color    = new SKColor(165, 168, 172);
            b3.StyleHover.ForegroundColor = new SKColor(36, 41, 46);
            b3.StyleHover.Border.Radius   = 3;

            Controls.Add(b3);

            var b4 = new Button {
                Text = "OK",
                Left = 475,
                Top  = 100
            };

            b4.Style.BackgroundColor = new SKColor(40, 167, 69);
            b4.Style.Border.Color    = new SKColor(46, 172, 77);
            b4.Style.ForegroundColor = new SKColor(255, 255, 255);
            b4.Style.Border.Radius   = 3;
            b4.Style.Border.Width    = 1;

            b4.StyleHover.BackgroundColor = new SKColor(38, 159, 66);
            b4.StyleHover.Border.Color    = new SKColor(36, 115, 58);
            b4.StyleHover.ForegroundColor = new SKColor(255, 255, 255);
            b4.StyleHover.Border.Radius   = 3;

            Controls.Add(b4);

            var b5 = new Button {
                Text = "OK",
                Left = 100,
                Top  = 200
            };

            b5.Style.Border.Width    = 1;
            b5.Style.BackgroundColor = new SKColor(243, 246, 248);
            b5.Style.ForegroundColor = new SKColor(36, 41, 46);
            b5.TextAlign             = ContentAlignment.MiddleLeft;

            Controls.Add(b5);

            var b6 = new Button {
                Text = "OK",
                Left = 225,
                Top  = 200
            };

            b6.Style.Border.Width    = 2;
            b6.Style.BackgroundColor = new SKColor(243, 246, 248);
            b6.Style.ForegroundColor = new SKColor(36, 41, 46);
            b6.TextAlign             = ContentAlignment.TopLeft;

            Controls.Add(b6);

            var b7 = new Button {
                Text = "OK",
                Left = 350,
                Top  = 200
            };

            b7.Style.Border.Width    = 3;
            b7.Style.BackgroundColor = new SKColor(243, 246, 248);
            b7.Style.ForegroundColor = new SKColor(36, 41, 46);
            b7.TextAlign             = ContentAlignment.TopRight;

            Controls.Add(b7);

            var b8 = new Button {
                Text = "OK",
                Left = 475,
                Top  = 200
            };

            b8.Style.Border.Width    = 4;
            b8.Style.BackgroundColor = new SKColor(243, 246, 248);
            b8.Style.ForegroundColor = new SKColor(36, 41, 46);
            b8.TextAlign             = ContentAlignment.BottomLeft;

            Controls.Add(b8);

            var b9 = new Button {
                Text = "OK",
                Left = 600,
                Top  = 200
            };

            b9.Style.Border.Width    = 5;
            b9.Style.BackgroundColor = new SKColor(243, 246, 248);
            b9.Style.ForegroundColor = new SKColor(36, 41, 46);
            b9.TextAlign             = ContentAlignment.BottomRight;

            Controls.Add(b9);

            var b10 = new Button {
                Text = "OK",
                Left = 725,
                Top  = 200
            };

            b10.Style.Border.Width    = 6;
            b10.Style.BackgroundColor = new SKColor(243, 246, 248);
            b10.Style.ForegroundColor = new SKColor(36, 41, 46);
            b10.TextAlign             = ContentAlignment.BottomCenter;

            Controls.Add(b10);

            var b11 = new Button {
                Text = "OK",
                Left = 100,
                Top  = 300
            };

            b11.Style.Border.Top.Width = 0;

            b11.Style.Border.Left.Width   = 2;
            b11.Style.Border.Left.Color   = SKColors.Green;
            b11.Style.Border.Right.Width  = 3;
            b11.Style.Border.Right.Color  = SKColors.Orange;
            b11.Style.Border.Bottom.Width = 3;
            b11.Style.Border.Bottom.Color = SKColors.Black;

            b11.Style.BackgroundColor = new SKColor(243, 246, 248);
            b11.Style.ForegroundColor = new SKColor(36, 41, 46);

            Controls.Add(b11);

            var cb1 = new CheckBox {
                Text    = "Option 1",
                Left    = 100,
                Top     = 400,
                Checked = true
            };

            Controls.Add(cb1);

            var cb2 = new CheckBox {
                Text = "Option 2",
                Left = 225,
                Top  = 400
            };

            Controls.Add(cb2);

            var rb1 = new RadioButton {
                Text    = "Option 1",
                Left    = 100,
                Top     = 500,
                Checked = true
            };

            Controls.Add(rb1);

            var rb2 = new RadioButton {
                Text = "Option 2",
                Left = 225,
                Top  = 500
            };

            Controls.Add(rb2);

            var tabstrip = new TabStrip {
                Left  = 100,
                Top   = 600,
                Width = 600
            };

            tabstrip.Tabs.Add(new TabStripItem {
                Text = "File", Selected = true
            });
            tabstrip.Tabs.Add(new TabStripItem {
                Text = "Share"
            });
            tabstrip.Tabs.Add(new TabStripItem {
                Text = "View"
            });

            Controls.Add(tabstrip);

            var v_scroll = new VerticalScrollBar {
                Left   = 900,
                Top    = 100,
                Height = 500
            };

            Controls.Add(v_scroll);

            var v_scroll_label = new Label {
                Left = 875,
                Top  = 625
            };

            v_scroll.ValueChanged += (o, e) => v_scroll_label.Text = v_scroll.Value.ToString();

            Controls.Add(v_scroll_label);

            var h_scroll = new HorizontalScrollBar {
                Left  = 100,
                Top   = 650,
                Width = 500
            };

            Controls.Add(h_scroll);

            var h_scroll_label = new Label {
                Left = 100,
                Top  = 685
            };

            h_scroll.ValueChanged += (o, e) => h_scroll_label.Text = h_scroll.Value.ToString();

            Controls.Add(h_scroll_label);

            var listbox = new ListBox {
                Left = 300,
                Top  = 300
            };

            listbox.Items.Add(new TestBlah {
                Text = "A Option"
            });
            listbox.Items.Add(new TestBlah {
                Text = "B Option"
            });
            listbox.Items.Add(new TestBlah {
                Text = "D Option"
            });
            listbox.Items.Add(new TestBlah {
                Text = "C Option"
            });

            listbox.SelectedIndex = 2;
            listbox.SelectionMode = SelectionMode.MultiExtended;

            Controls.Add(listbox);

            var titlebar = new FormTitleBar {
                Text = "Button Style Sample"
            };

            Controls.Add(titlebar);
        }
示例#13
0
        protected virtual void SelectDataGrid_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (!IsFine || e.Button != MouseButtons.Left || e.Clicks != 1 || Disposing || IsDisposed)
            {
                return;
            }
            object keyObject = KeyObject;

            try
            {
                this.block = true;

                DocsDataGridColumnHeaderCell currentHeaderCell = (DocsDataGridColumnHeaderCell)Columns[e.ColumnIndex].HeaderCell;

                switch (currentHeaderCell.SortOrder)
                {
                case 0:                         // стобец в сортировке не участвовал ранее
                    for (byte i = 0; i < Columns.Count; i++)
                    {
                        if (Columns[i].Visible &&
                            ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder < 6 &&
                            ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder > 0)
                        {
                            if (((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder == 5)
                            {
                                ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder = 0;
                                Columns[i].HeaderCell.SortGlyphDirection = SortOrder.None;
                            }
                            else
                            {
                                ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder++;
                            }
                        }
                    }
                    currentHeaderCell.SortOrder          = 1;
                    currentHeaderCell.SortGlyphDirection = SortOrder.Descending;
                    break;

                case 1:                         // поменяем направление сортировки
                    currentHeaderCell.SortGlyphDirection = currentHeaderCell.SortGlyphDirection == SortOrder.Ascending
                                                                ? SortOrder.Descending
                                                                : SortOrder.Ascending;
                    break;

                default:                         // попали в столбец, который ранее был в очереди, но не первый
                    byte _sortOrder = currentHeaderCell.SortOrder;
                    for (byte i = 0; i < Columns.Count; i++)
                    {
                        if (Columns[i].Visible &&
                            ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder < _sortOrder &&
                            ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder > 0)
                        {
                            ((DocsDataGridColumnHeaderCell)Columns[i].HeaderCell).SortOrder++;
                        }
                    }

                    currentHeaderCell.SortOrder = 1;
                    break;
                }
                this.DataBindingComplete -= SelectDataGrid_DataBindingComplete;
                this.DataBindingComplete += new DataGridViewBindingCompleteEventHandler(SelectDataGrid_DataBindingComplete);

                MakeSortOrder(true);
            }
            catch (Exception ex)
            {
                Data.Env.WriteToLog(ex);
            }
            finally
            {
                //if(this.DataBindings != null)
                //    this.GetDataView().EndInit();
                //if(keyObject == null)
                //{
                //    this.block = false;
                //    ClearSelection();
                //}
                //else
                //    SelectRow(keyObject);
                //this.block = false;

                if (VerticalScrollBar.Visible)
                {
                    VerticalScrollBar.Invalidate();
                }
                if (HorizontalScrollBar.Visible)
                {
                    HorizontalScrollBar.Invalidate();
                }
            }
        }