コード例 #1
0
        public override void OnInit()
        {
            Gui.AddWidgets(new Widget[] {
                panel_Editor      = new Elements.Window(274 + 8, 4 + 24, 514, 592 - 24, Elements.WindowButtons.None),
                panel_TileControl = new Elements.Window(4, 4 + 24, 274, 112),
                panel_Tiles       = new Elements.Window(4, 4 + 28 + 112, 274, 592 - 28 - 112)
            });

            panel_TileControl.AddWidgets(new Widget[] {
                lbl_TileCount = new Label(8, 14, string.Empty),
                btn_AddTiles  = new Button(192, 4, 32, "+", click_AddTiles),
                btn_SubTiles  = new Button(228, 4, 32, "-", click_SubTiles),
                new Label(8, 48, "Palette:"),
                combo_Palettes = new ComboBox(82, 40, 164, string.Empty)
                {
                    OnSelectionChanged = OnPaletteChange
                }
            });

            for (int i = 0; i < 4; i++)
            {
                Elements.PaletteSingleColor well = new Elements.PaletteSingleColor(82 + 45 * i, 76, 41, 24, i, 0, 0, wells_OnClick);
                panel_TileControl.AddWidget(well);
                m_Wells.Add(well);
            }

            panel_Tiles.AddWidget(
                scr_TileGfxPages = new ScrollBars());

            refreshControlPanel();
            refreshTilePalePanel();
            refreshTiles();
            refreshPaletteCombo();
            wells_OnClick(m_Wells[0]);
        }
コード例 #2
0
ファイル: FormControl.cs プロジェクト: yrenlai/VBASync
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (FontTextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)NextAvailableId;
         hashCode = (hashCode * 397) ^ (BooleanProperties?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ GroupCount;
         hashCode = (hashCode * 397) ^ (int)Cycle;
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)Zoom;
         hashCode = (hashCode * 397) ^ (int)PictureAlignment;
         hashCode = (hashCode * 397) ^ (int)PictureSizeMode;
         hashCode = (hashCode * 397) ^ (int)ShapeCookie;
         hashCode = (hashCode * 397) ^ (int)DrawBuffer;
         hashCode = (hashCode * 397) ^ (DisplayedSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (LogicalSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ScrollPosition?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ FontIsStdFont.GetHashCode();
         hashCode = (hashCode * 397) ^ (FontStdFont?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
コード例 #3
0
      /// DlgToolsOptions_Closed - Copy values from dialog
      /// controls to associated public fields.
      private void DlgToolsOptions_Closed(
         object sender, 
         System.EventArgs e)
      {
         // Make window visible when closing.
         m_formParent.Visible = true;

         // Update scrollbar setting.      
         if (optBothScroll.Checked)
            sbScrollBars = ScrollBars.Both;
         else if (optVertScroll.Checked)
            sbScrollBars = ScrollBars.Vertical;
         else if (optHorzScroll.Checked)
            sbScrollBars = ScrollBars.Horizontal;
         else
            sbScrollBars = ScrollBars.None;

         // Update program menu & toolbar settings.
         bProgramMenu = chkProgMenu.Checked;
         bToolbar = chkToolbar.Checked;

         // Update text alignment setting.
         Align iSel = (Align)comboTextAlign.SelectedIndex;
         if (iSel == Align.Left)
            haTextAlign = HorizontalAlignment.Left;
         else if (iSel == Align.Center)
            haTextAlign = HorizontalAlignment.Center;
         else
            haTextAlign = HorizontalAlignment.Right;

         // Update word wrap ssetting.
         bWordWrap = chkWordWrap.Checked;
      }
コード例 #4
0
        public override void PaintControl(RichTextBox control, ControlPaintArgs args)
        {
            INode    controlNode = new ControlNode(control);
            IRuleset ruleset     = args.StyleSheet.GetRuleset(controlNode);

            RenderUtilities.ApplyColorProperties(control, ruleset);

            Rectangle clientRect = control.ClientRectangle;
            Rectangle borderRect = new Rectangle(clientRect.X - 3, clientRect.Y - 3, clientRect.Width + 6, clientRect.Height + 6);

            ScrollBars visibleScrollbars = ControlUtilities.GetVisibleScrollBars(control);

            if (visibleScrollbars.HasFlag(ScrollBars.Vertical))
            {
                borderRect = new Rectangle(borderRect.X, borderRect.Y, borderRect.Width + SystemInformation.VerticalScrollBarWidth, borderRect.Height);
            }

            if (visibleScrollbars.HasFlag(ScrollBars.Horizontal))
            {
                borderRect = new Rectangle(borderRect.X, borderRect.Y, borderRect.Width, borderRect.Height + SystemInformation.HorizontalScrollBarHeight);
            }

            args.PaintBackground(borderRect);
            args.PaintBorder(borderRect);
        }
コード例 #5
0
        /// <summary>
        /// Sets up the 'Current map' Panel.
        /// </summary>
        private void refreshCurrentMapPanel()
        {
            if (scrCurrentMap == null)
            {
                panelCurrentMap.AddWidget(scrCurrentMap = new ScrollBars());
                State.MapScreen_WindowArea = new Point(panelCurrentMap.InputArea.Width, panelCurrentMap.InputArea.Width);
            }

            Data.Map map     = State.Data.Maps[State.SelectedMap];
            Point    mapArea = new Point(map.WidthInSuperChunks * 256, map.HeightInSuperChunks * 256);

            scrCurrentMap.OverrideScrollArea(new Rectangle(0, 0, mapArea.X, mapArea.Y));
            State.MapScreen_MapArea = mapArea;

            if (State.MapScreen_Scroll.X >= mapArea.X - panelCurrentMap.InputArea.Width)
            {
                State.MapScreen_Scroll.X = mapArea.X - panelCurrentMap.InputArea.Width;
            }
            if (State.MapScreen_Scroll.Y >= mapArea.Y - panelCurrentMap.InputArea.Height)
            {
                State.MapScreen_Scroll.Y = mapArea.Y - panelCurrentMap.InputArea.Height;
            }

            initializeMapAndLoadAllChunks(1);
            mmpMini.RefreshEntireMap(State.Data.Maps[State.SelectedMap]);
        }
コード例 #6
0
        /// <summary>TextBox在文字未超出边界时隐藏滚动条,超出时显示</summary>
        public static void SetAutoShowScroll(this TextBox box, ScrollBars scrollBars)
        {
            void SetScrollVisible()
            {
                Size szBox  = box.ClientSize;
                Size szText = TextRenderer.MeasureText(box.Text, box.Font);

                if ((scrollBars | ScrollBars.Vertical) == ScrollBars.Vertical)
                {
                    if (szText.Height > szBox.Height)
                    {
                        box.ScrollBars = scrollBars | ScrollBars.Vertical;
                    }
                    else
                    {
                        box.ScrollBars = scrollBars & ~ScrollBars.Vertical;
                    }
                }
                if ((scrollBars | ScrollBars.Horizontal) == ScrollBars.Horizontal)
                {
                    if (szText.Width > szBox.Width)
                    {
                        box.ScrollBars = scrollBars | ScrollBars.Horizontal;
                    }
                    else
                    {
                        box.ScrollBars = scrollBars & ~ScrollBars.Horizontal;
                    }
                }
            };
            box.TextChanged       += (sender, e) => SetScrollVisible();
            box.FontChanged       += (sender, e) => SetScrollVisible();
            box.ClientSizeChanged += (sender, e) => SetScrollVisible();
        }
 public RepositoryItemMultiLineButtonEdit()
 {
     this._acceptsTab    = false;
     this._acceptsReturn = true;
     this._linesCount    = 0;
     this._scrollBars    = ScrollBars.None;
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SceneEditorWindow"/> class.
 /// </summary>
 /// <param name="editor">The editor.</param>
 /// <param name="hideOnClose">True if hide window on closing, otherwise it will be destroyed.</param>
 /// <param name="scrollBars">The scroll bars.</param>
 protected SceneEditorWindow(Editor editor, bool hideOnClose, ScrollBars scrollBars)
     : base(editor, hideOnClose, scrollBars)
 {
     // Setup input actions
     InputActions.Add(options => options.Save, Editor.SaveAll);
     InputActions.Add(options => options.Undo, () =>
     {
         Editor.PerformUndo();
         Focus();
     });
     InputActions.Add(options => options.Redo, () =>
     {
         Editor.PerformRedo();
         Focus();
     });
     InputActions.Add(options => options.Cut, Editor.SceneEditing.Cut);
     InputActions.Add(options => options.Copy, Editor.SceneEditing.Copy);
     InputActions.Add(options => options.Paste, Editor.SceneEditing.Paste);
     InputActions.Add(options => options.Duplicate, Editor.SceneEditing.Duplicate);
     InputActions.Add(options => options.SelectAll, Editor.SceneEditing.SelectAllScenes);
     InputActions.Add(options => options.Delete, Editor.SceneEditing.Delete);
     InputActions.Add(options => options.Search, () => Editor.Windows.SceneWin.Search());
     InputActions.Add(options => options.Play, Editor.Simulation.RequestStartPlay);
     InputActions.Add(options => options.Pause, Editor.Simulation.RequestResumeOrPause);
     InputActions.Add(options => options.StepFrame, Editor.Simulation.RequestPlayOneFrame);
 }
コード例 #9
0
ファイル: EditorWindow.cs プロジェクト: ThinkingInXyZ/FlaxAPI
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="hideOnClose">True if hide window on closing, otherwise it will be destroyed.</param>
        /// <param name="scrollBars">The scroll bars.</param>
        protected EditorWindow(Editor editor, bool hideOnClose, ScrollBars scrollBars)
            : base(editor.UI.MasterPanel, hideOnClose, scrollBars)
        {
            Editor = editor;

            // Register
            Editor.Windows.Windows.Add(this);
        }
コード例 #10
0
ファイル: PdfRenderer.cs プロジェクト: UIKit0/PdfiumViewer
 private Rectangle GetScrollClientArea(ScrollBars scrollbars)
 {
     return(new Rectangle(
                0,
                0,
                scrollbars == ScrollBars.Vertical || scrollbars == ScrollBars.Both ? Width - SystemInformation.VerticalScrollBarWidth : Width,
                scrollbars == ScrollBars.Horizontal || scrollbars == ScrollBars.Both ? Height - SystemInformation.HorizontalScrollBarHeight : Height
                ));
 }
コード例 #11
0
        TextBox TextboxCriete(Panel panel, ScrollBars scrolltype)
        {
            // Создаёт эллемент textBox в panel
            TextBox textBox = new TextBox {
                Location = new Point(0, 0), Multiline = true, Dock = DockStyle.Fill, ReadOnly = true, BackColor = panel1.BackColor, ScrollBars = scrolltype
            };

            panel.Controls.Add(textBox);
            return(textBox);
        }
コード例 #12
0
        /// <summary>
        /// Sets the data source on the <see cref="DataGridView"/>.
        /// </summary>
        /// <param name="dataSource">The data source to set.</param>
        /// <remarks>
        /// <list type="bullet">
        /// <item>Providing a value of <c>null</c> for <paramref name="dataSource"/>
        /// will clear the grid view.</item>
        /// <item>To reset the scrollbars to the starting position,
        /// the scrollbars need to be set to none before changing the datasource.</item>
        /// </list></remarks>
        public void SetDataSource(IEnumerable dataSource)
        {
            ScrollBars originalScrollBarsValue = dataGridView.ScrollBars;

            dataGridView.ScrollBars = ScrollBars.None;

            dataGridView.DataSource = dataSource;

            dataGridView.ScrollBars = originalScrollBarsValue;
        }
コード例 #13
0
ファイル: FrmWelcome.cs プロジェクト: views63/Logbert
        protected override void OnVisibleScrollbarsChanged(ScrollBars newValue)
        {
            base.OnVisibleScrollbarsChanged(newValue);

            if (newValue != ScrollBars.None && OSHelper.IsWinVista && !string.IsNullOrEmpty(ThemeManager.CurrentApplicationTheme.WindowThemeName))
            {
                this.BeginInvoke(new Action(() =>
                                            Gui.Interop.Win32.SetWindowTheme(Handle, ThemeManager.CurrentApplicationTheme.WindowThemeName, null))
                                 );
            }
        }
コード例 #14
0
 public void SetScrollValue(ScrollBars bars, int value, bool asynchronous)
 {
     if (asynchronous)
     {
         Invoke(new SetScrollValueProc(SetScrollValue), bars, value);
     }
     else
     {
         SetScrollValue(bars, value);
     }
 }
コード例 #15
0
        public static ScrollBars GetVisibleScrollBars(ListBox control)
        {
            ScrollBars scrollBars = ScrollBars.None;

            if (Enumerable.Range(0, control.Items.Count).Sum(i => control.GetItemHeight(i)) > control.Height)
            {
                scrollBars |= ScrollBars.Vertical;
            }

            return(scrollBars);
        }
コード例 #16
0
ファイル: PdfRenderer.cs プロジェクト: jy4618272/PdfViewer
        private void UpdateScaleFactor(ScrollBars scrollBars)
        {
            var bounds = GetScrollClientArea(scrollBars);

            int height = bounds.Height - ShadeBorder.Size.Vertical - PageMargin.Vertical;

            // Scale factor determines what we need to multiply the dimensions
            // of the metafile with to get the size in the control.

            _scaleFactor = ((double)height / DefaultSettings.Height) * Zoom;
        }
コード例 #17
0
 /// <summary>
 /// Sets the scroll bars.
 /// </summary>
 /// <param name="textBox">The text box.</param>
 /// <param name="value">The value.</param>
 public static void SetScrollBars(this TextBox textBox, ScrollBars value)
 {
     if (textBox.InvokeRequired)
     {
         textBox.BeginInvoke(new MethodInvoker(() => textBox.SetScrollBars(value)));
     }
     else
     {
         textBox.ScrollBars = value;
         textBox.Refresh();
     }
 }
コード例 #18
0
        public void SetScrollValue(ScrollBars bars, int value)
        {
            if (bars == ScrollBars.Horizontal || bars == ScrollBars.Both)
            {
                HScroll.Value = Math.Max(HorizontalScroll.Minimum, Math.Min(HorizontalScroll.Maximum - HorizontalScroll.LargeChange, value));
            }

            if (bars == ScrollBars.Vertical || bars == ScrollBars.Both)
            {
                VScroll.Value = Math.Max(VerticalScroll.Minimum, Math.Min(VerticalScroll.Maximum - VerticalScroll.LargeChange, value));
            }
        }
コード例 #19
0
 /// <summary>
 /// Recalculate the height of the DataGridView
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void summaryControl_VisibilityChanged(object sender, EventArgs e)
 {
     if (!summaryControl.Visible)
     {
         ScrollBars  = ScrollBars.Both;
         this.Height = panel.Height;
     }
     else
     {
         this.Height = panel.Height - summaryControl.Height - summaryRowSpace;
         ScrollBars  = ScrollBars.Vertical;
     }
 }
コード例 #20
0
ファイル: WinFormOpt.cs プロジェクト: zhongshuiyuan/WLib
 /// <summary>
 /// 获取控件滚动条的宽度,没有滚动条则返回0
 /// </summary>
 /// <param name="ctrl"></param>
 /// <returns></returns>
 public static int GetScrollWidth(this Control ctrl, ScrollBars scrollBars)
 {
     if (ctrl is ScrollableControl sCtrl)
     {
         if (scrollBars == ScrollBars.Vertical)
         {
             return(sCtrl.Size.Height - sCtrl.ClientSize.Height);
         }
         else if (scrollBars == ScrollBars.Horizontal)
         {
             return(sCtrl.Size.Width - sCtrl.ClientSize.Width);
         }
     }
     return(0);
 }
コード例 #21
0
ファイル: MslEdit.cs プロジェクト: AndrioCelos/MScripter
            private void SetScrollBars()
            {
                ScrollBars value = 0;

                if (this.autohs || this.hsbar)
                {
                    value |= ScrollBars.Horizontal;
                }
                if (this.autovs || this.vsbar)
                {
                    value |= ScrollBars.Vertical;
                }
                ((TextBox)this.Control).ScrollBars = value;
                this.OnStyleChanged(EventArgs.Empty);
            }
コード例 #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="hideOnClose">True if hide window on closing, otherwise it will be destroyed.</param>
        /// <param name="scrollBars">The scroll bars.</param>
        protected EditorWindow(Editor editor, bool hideOnClose, ScrollBars scrollBars)
            : base(editor.UI.MasterPanel, hideOnClose, scrollBars)
        {
            Editor = editor;

            InputActions.Add(options => options.ContentFinder, () =>
            {
                if (CanOpenContentFinder)
                {
                    Editor.ContentFinding.ShowFinder(RootWindow);
                }
            });

            // Register
            Editor.Windows.Windows.Add(this);
        }
コード例 #23
0
ファイル: ExceptionForm.cs プロジェクト: laszlo-kiss/Dataphor
 private void UpdateSize()
 {
     if (this.IsHandleCreated)
     {
         Size      overhead = Size - _exceptionMessage.DisplayRectangle.Size;
         Rectangle working  = _working;
         working.Size    = working.Size - overhead;              // Convert working to inner size
         working.Width  -= System.Windows.Forms.SystemInformation.VerticalScrollBarWidth;
         working.Height -= System.Windows.Forms.SystemInformation.HorizontalScrollBarHeight;
         Size size;
         using (System.Drawing.Graphics graphics = _exceptionMessage.CreateGraphics())
         {
             if (_exceptionMessage.WordWrap)
             {
                 size = Size.Ceiling(graphics.MeasureString(_exceptionMessage.Text, _exceptionMessage.Font, working.Width));
             }
             else
             {
                 size = Size.Ceiling(graphics.MeasureString(_exceptionMessage.Text, _exceptionMessage.Font));
             }
         }
         ScrollBars scrollBars = ScrollBars.None;
         if (size.Height > working.Height)
         {
             size.Height = working.Height;
             scrollBars |= ScrollBars.Vertical;
         }
         if (size.Width > working.Width)
         {
             size.Width  = working.Width;
             scrollBars |= ScrollBars.Horizontal;
         }
         _exceptionMessage.ScrollBars = scrollBars;
         Element.ConstrainMin(ref size, new Size(220, 26));
         size       += overhead;
         this.Bounds =
             new Rectangle
             (
                 new Point
                 (
                     ((_working.Width / 2) - (size.Width / 2)) + _working.Left,
                     ((_working.Height / 2) - (size.Height / 2)) + _working.Top
                 ),
                 size
             );
     }
 }
コード例 #24
0
        public void ScrollSamllChange(ScrollBars bars, int pages)
        {
            if (bars == ScrollBars.None || pages == 0)
            {
                return;
            }

            if (bars == ScrollBars.Horizontal || bars == ScrollBars.Both)
            {
                SetScrollValue(ScrollBars.Horizontal, HorizontalScroll.Value + HorizontalScroll.SmallChange * pages);
            }

            if (bars == ScrollBars.Vertical || bars == ScrollBars.Both)
            {
                SetScrollValue(ScrollBars.Vertical, VerticalScroll.Value + VerticalScroll.SmallChange * pages);
            }
        }
コード例 #25
0
        public DlgToolsOptions(Control ctrlParent)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Remember parent to help later in cleanup
            m_formParent = ctrlParent;

            // Set default values.
            sbScrollBars = ScrollBars.None;
            bProgramMenu = true;
            bToolbar     = true;
            haTextAlign  = HorizontalAlignment.Left;
            bWordWrap    = false;
        }
コード例 #26
0
        // update position of child grids after scrolling
        //
        // when the grid scrolls vertically, move child grids so they
        // stay in their proper position.
        //
        override protected void OnScroll(ScrollBars sb)
        {
            // always call base implementation
            base.OnScroll(sb);

            // adjust horizontal position of the 'header' flex <<1.1>>
            if (sb != ScrollBars.Vertical)
            {
                _hdr.ScrollPosition = new Point(ScrollPosition.X, 0);
            }

            // adjust vertical position of the child grids
            if (sb != ScrollBars.Horizontal)
            {
                UpdateChildren();
            }
        }
コード例 #27
0
        public static ScrollBars GetVisibleScrollBars(Control control)
        {
            ScrollBars scrollBars = ScrollBars.None;

            Size size = control.GetPreferredSize(Size.Empty);

            if (size.Height > control.Height)
            {
                scrollBars |= ScrollBars.Vertical;
            }

            if (size.Width > control.Width)
            {
                scrollBars |= ScrollBars.Horizontal;
            }

            return(scrollBars);
        }
コード例 #28
0
        public static ScrollBars GetVisibleScrollBars(TextBox control)
        {
            ScrollBars scrollBars = ScrollBars.None;

            if (control.Multiline)
            {
                scrollBars = control.ScrollBars;

                // If WordWrap is enabled, the horizontal scroll bar never appears, even if it is enabled.

                if (control.WordWrap)
                {
                    scrollBars &= ~ScrollBars.Horizontal;
                }
            }

            return(scrollBars);
        }
        public override void Assign(RepositoryItem item)
        {
            RepositoryItemMultiLineButtonEdit source = item as RepositoryItemMultiLineButtonEdit;

            BeginUpdate();
            try {
                base.Assign(item);
                if (source == null)
                {
                    return;
                }
                this._acceptsReturn = source.AcceptsReturn;
                this._acceptsTab    = source.AcceptsTab;
                this._scrollBars    = source.ScrollBars;
                this._linesCount    = source.LinesCount;
            } finally {
                EndUpdate();
            }
        }
コード例 #30
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VariousPropertyBits;
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)PicturePosition;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (Accelerator?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Size?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Picture?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (MouseIcon?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (TextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)MaxLength;
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ DisplayStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ (PasswordChar?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)ListWidth;
         hashCode = (hashCode * 397) ^ BoundColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ TextColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnCount.GetHashCode();
         hashCode = (hashCode * 397) ^ ListRows.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnInfoCount.GetHashCode();
         hashCode = (hashCode * 397) ^ MatchEntry.GetHashCode();
         hashCode = (hashCode * 397) ^ ListStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ ShowDropButtonWhen.GetHashCode();
         hashCode = (hashCode * 397) ^ DropButtonStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ MultiSelect.GetHashCode();
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (GroupName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Remainder?.Length.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
コード例 #31
0
ファイル: ZaDataGridView.cs プロジェクト: zediah/ZedLedger
        public ScrollBar GetScrollBar(ScrollBars barType)
        {
            ScrollBar returnValue = null;
            try
            {
                switch (barType)
                {
                    case System.Windows.Forms.ScrollBars.Horizontal:
                        returnValue = HorizontalScrollBar;
                        break;
                    case System.Windows.Forms.ScrollBars.Vertical:
                        returnValue = VerticalScrollBar;
                        break;

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return returnValue;
        }
コード例 #32
0
ファイル: Dialogs.cs プロジェクト: akretion/uninfe
        public static void ShowMessage(string msg, int w, int h, System.Windows.Forms.MessageBoxIcon iconStyle, ScrollBars scrollBars = ScrollBars.None)
        {
            using (Dialogs form = new Dialogs())
            {
                form.btnYes.Visible = false;

                if (iconStyle == MessageBoxIcon.Information)
                    form.pictureBox1.Image = Properties.Resources.information;
                else if (iconStyle == MessageBoxIcon.Warning)
                    form.pictureBox1.Image = Properties.Resources.warning;
                else if (iconStyle == MessageBoxIcon.Error)
                    form.pictureBox1.Image = Properties.Resources.error;
                else
                    form.pictureBox1.Visible = false;

                form.metroTextBox3.Text = msg;
                form.metroTextBox3.ScrollBars = scrollBars;
                if (w > 0)
                    form.Width = w;
                if (h > 0)
                    form.Height = Math.Max(150, h);
                form.ShowDialog();
            }
        }
コード例 #33
0
ファイル: ModUiTools.cs プロジェクト: 0ks3ii/IronWASP
 static string XmlFromControlScrollBarsProperty(ScrollBars ScBars)
 {
     return XmlFromTagValue(ModUiTags.ScrollBars, ScBars);
 }
コード例 #34
0
#pragma warning restore 0414
#endif
        /// <include file='doc\DataGridView.uex' path='docs/doc[@for="DataGridView.DataGridView"]/*' />
        /// <devdoc>
        /// <para>Initializes a new instance of the <see cref='System.Windows.Forms.DataGridView'/> class.</para>
        /// </devdoc>
        public DataGridView()
        {
            SetStyle(ControlStyles.UserPaint | 
                     ControlStyles.Opaque | 
                     ControlStyles.UserMouse, true);
            
            SetStyle(ControlStyles.SupportsTransparentBackColor, false);

            // this class overrides GetPreferredSizeCore, let Control automatically cache the result
            SetState2(STATE2_USEPREFERREDSIZECACHE, true);  

            this.dataGridViewState1 = new System.Collections.Specialized.BitVector32(0x00000000);
            this.dataGridViewState2 = new System.Collections.Specialized.BitVector32(0x00000000);
            this.dataGridViewOper   = new System.Collections.Specialized.BitVector32(0x00000000);

            this.dataGridViewState1[  DATAGRIDVIEWSTATE1_columnHeadersVisible 
                                    | DATAGRIDVIEWSTATE1_rowHeadersVisible 
                                    | DATAGRIDVIEWSTATE1_autoGenerateColumns
                                    | DATAGRIDVIEWSTATE1_allowUserToAddRows
                                    | DATAGRIDVIEWSTATE1_allowUserToDeleteRows ] = true;



            this.dataGridViewState2[  DATAGRIDVIEWSTATE2_showEditingIcon
                                    | DATAGRIDVIEWSTATE2_enableHeadersVisualStyles
                                    | DATAGRIDVIEWSTATE2_mouseEnterExpected
                                    | DATAGRIDVIEWSTATE2_allowUserToResizeColumns
                                    | DATAGRIDVIEWSTATE2_allowUserToResizeRows
                                    | DATAGRIDVIEWSTATE2_showCellToolTips
                                    | DATAGRIDVIEWSTATE2_showCellErrors
                                    | DATAGRIDVIEWSTATE2_showRowErrors
                                    | DATAGRIDVIEWSTATE2_allowHorizontalScrollbar
                                    | DATAGRIDVIEWSTATE2_usedFillWeightsDirty ] = true;


            this.displayedBandsInfo = new DisplayedBandsData();
            this.lstRows = new ArrayList();

            this.converters = new Hashtable(8);
            this.pens = new Hashtable(8);
            this.brushes = new Hashtable(10);
            this.gridPen = new Pen(DefaultGridColor);

            this.selectedBandIndexes = new DataGridViewIntLinkedList();
            this.individualSelectedCells = new DataGridViewCellLinkedList();
            this.individualReadOnlyCells = new DataGridViewCellLinkedList();

            this.advancedCellBorderStyle = new DataGridViewAdvancedBorderStyle(this, 
                DataGridViewAdvancedCellBorderStyle.OutsetDouble, 
                DataGridViewAdvancedCellBorderStyle.OutsetPartial, 
                DataGridViewAdvancedCellBorderStyle.InsetDouble);
            this.advancedRowHeadersBorderStyle = new DataGridViewAdvancedBorderStyle(this);
            this.advancedColumnHeadersBorderStyle = new DataGridViewAdvancedBorderStyle(this);
            this.advancedCellBorderStyle.All = defaultAdvancedCellBorderStyle;
            this.advancedRowHeadersBorderStyle.All = defaultAdvancedRowHeadersBorderStyle;
            this.advancedColumnHeadersBorderStyle.All = defaultAdvancedColumnHeadersBorderStyle;
            this.borderStyle = defaultBorderStyle;
            this.dataGridViewState1[DATAGRIDVIEWSTATE1_multiSelect] = true;
            this.selectionMode = defaultSelectionMode;
            this.editMode = defaultEditMode;
            this.autoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
            this.autoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
            this.columnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
            this.rowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing;

            this.clipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithAutoHeaderText;

            this.layout = new LayoutData();
            this.layout.TopLeftHeader        = Rectangle.Empty;
            this.layout.ColumnHeaders        = Rectangle.Empty;
            this.layout.RowHeaders           = Rectangle.Empty;
            this.layout.ColumnHeadersVisible = true;
            this.layout.RowHeadersVisible    = true;
            this.layout.ClientRectangle      = this.ClientRectangle;

            this.scrollBars = ScrollBars.Both;

            this.horizScrollBar.RightToLeft = RightToLeft.Inherit;
            this.horizScrollBar.AccessibleName = SR.GetString(SR.DataGridView_AccHorizontalScrollBarAccName);
            this.horizScrollBar.Top = this.ClientRectangle.Height - horizScrollBar.Height;
            this.horizScrollBar.Left = 0;
            this.horizScrollBar.Visible = false;
            this.horizScrollBar.Scroll += new ScrollEventHandler(DataGridViewHScrolled);
            this.Controls.Add(this.horizScrollBar);

            this.vertScrollBar.Top = 0;
            this.vertScrollBar.AccessibleName = SR.GetString(SR.DataGridView_AccVerticalScrollBarAccName);
            this.vertScrollBar.Left = this.ClientRectangle.Width - vertScrollBar.Width;
            this.vertScrollBar.Visible = false;
            this.vertScrollBar.Scroll += new ScrollEventHandler(DataGridViewVScrolled);
            this.Controls.Add(this.vertScrollBar);

            this.ptCurrentCell = new Point(-1, -1);
            this.ptAnchorCell = new Point(-1, -1);
            this.ptMouseDownCell = new Point(-2, -2);
            this.ptMouseEnteredCell = new Point(-2, -2);
            this.ptToolTipCell = new Point(-1, -1);
            this.ptMouseDownGridCoord = new Point(-1, -1);

            this.sortOrder = SortOrder.None;

            this.lastMouseClickInfo.timeStamp = 0;

            WireScrollBarsEvents();
            PerformLayout();

            this.toolTipControl = new DataGridViewToolTip(this);
            
            Invalidate();
        }
コード例 #35
0
ファイル: PdfRenderer.cs プロジェクト: moclad/PdfiumViewer
        private void UpdateScaleFactor(ScrollBars scrollBars)
        {
            var bounds = GetScrollClientArea(scrollBars);

            // Scale factor determines what we need to multiply the dimensions
            // of the metafile with to get the size in the control.

            if (ZoomMode == PdfViewerZoomMode.FitHeight)
            {
                int height = bounds.Height - ShadeBorder.Size.Vertical - PageMargin.Vertical;

                _scaleFactor = ((double)height / _maxHeight) * Zoom;
            }
            else
            {
                int width = bounds.Width - ShadeBorder.Size.Horizontal - PageMargin.Horizontal;

                _scaleFactor = ((double)width / _maxWidth) * Zoom;
            }
        }
コード例 #36
0
ファイル: PdfRenderer.cs プロジェクト: moclad/PdfiumViewer
 private Rectangle GetScrollClientArea(ScrollBars scrollbars)
 {
     return new Rectangle(
         0,
         0,
         scrollbars == ScrollBars.Vertical || scrollbars == ScrollBars.Both ? Width - SystemInformation.VerticalScrollBarWidth : Width,
         scrollbars == ScrollBars.Horizontal || scrollbars == ScrollBars.Both ? Height - SystemInformation.HorizontalScrollBarHeight : Height
     );
 }
コード例 #37
0
ファイル: Scrolling.cs プロジェクト: erisonliang/qizmt
		private void ResetScrollBars()
		{
			ScrollBars = ScrollBars.Both;
		}
コード例 #38
0
ファイル: DataGridView.cs プロジェクト: vnan122/mono
		public DataGridView ()
		{
			SetStyle (ControlStyles.Opaque, true);
			//SetStyle (ControlStyles.UserMouse, true);
			SetStyle (ControlStyles.OptimizedDoubleBuffer, true);
			
			adjustedTopLeftHeaderBorderStyle = new DataGridViewAdvancedBorderStyle();
			adjustedTopLeftHeaderBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
			advancedCellBorderStyle = new DataGridViewAdvancedBorderStyle();
			advancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
			advancedColumnHeadersBorderStyle = new DataGridViewAdvancedBorderStyle();
			advancedColumnHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
			advancedRowHeadersBorderStyle = new DataGridViewAdvancedBorderStyle();
			advancedRowHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
			alternatingRowsDefaultCellStyle = new DataGridViewCellStyle();
			allowUserToAddRows = true;
			allowUserToDeleteRows = true;
			allowUserToOrderColumns = false;
			allowUserToResizeColumns = true;
			allowUserToResizeRows = true;
			autoGenerateColumns = true;
			autoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
			autoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
			backColor = Control.DefaultBackColor;
			backgroundColor = SystemColors.AppWorkspace;
			borderStyle = BorderStyle.FixedSingle;
			cellBorderStyle = DataGridViewCellBorderStyle.Single;
			clipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithAutoHeaderText;
			columnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
			columnHeadersDefaultCellStyle = new DataGridViewCellStyle();
			columnHeadersDefaultCellStyle.BackColor = SystemColors.Control;
			columnHeadersDefaultCellStyle.ForeColor = SystemColors.WindowText;
			columnHeadersDefaultCellStyle.SelectionBackColor = SystemColors.Highlight;
			columnHeadersDefaultCellStyle.SelectionForeColor = SystemColors.HighlightText;
			columnHeadersDefaultCellStyle.Font = this.Font;
			columnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
			columnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;
			columnHeadersHeight = 23;
			columnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
			columnHeadersVisible = true;
			columns = CreateColumnsInstance();
			columns.CollectionChanged += OnColumnCollectionChanged;
			currentCellAddress = new Point (-1, -1);
			dataMember = String.Empty;
			defaultCellStyle = new DataGridViewCellStyle();
			defaultCellStyle.BackColor = SystemColors.Window;
			defaultCellStyle.ForeColor = SystemColors.ControlText;
			defaultCellStyle.SelectionBackColor = SystemColors.Highlight;
			defaultCellStyle.SelectionForeColor = SystemColors.HighlightText;
			defaultCellStyle.Font = this.Font;
			defaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
			defaultCellStyle.WrapMode = DataGridViewTriState.False;
			editMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
			firstDisplayedScrollingColumnHiddenWidth = 0;
			isCurrentCellDirty = false;
			multiSelect = true;
			readOnly = false;
			rowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
			rowHeadersDefaultCellStyle = (DataGridViewCellStyle) columnHeadersDefaultCellStyle.Clone ();
			rowHeadersVisible = true;
			rowHeadersWidth = 41;
			rowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing;
			rows = CreateRowsInstance();
			rowsDefaultCellStyle = new DataGridViewCellStyle();
			selectionMode = DataGridViewSelectionMode.RowHeaderSelect;
			showCellErrors = true;
			showEditingIcon = true;
			scrollBars = ScrollBars.Both;
			userSetCursor = Cursor.Current;
			virtualMode = false;

			horizontalScrollBar = new HScrollBar();
			horizontalScrollBar.Scroll += OnHScrollBarScroll;
			horizontalScrollBar.Visible = false;
			
			verticalScrollBar = new VScrollBar();
			verticalScrollBar.Scroll += OnVScrollBarScroll;
			verticalScrollBar.Visible = false;
			
			Controls.AddRange (new Control[] {horizontalScrollBar, verticalScrollBar});
		}
コード例 #39
0
ファイル: PdfRenderer.cs プロジェクト: curveto-gh/PdfViewer
        private void UpdateScaleFactor(ScrollBars scrollBars)
        {
            var bounds = GetScrollClientArea(scrollBars);

            int height = bounds.Height - ShadeBorder.Size.Vertical - PageMargin.Vertical;

            // Scale factor determines what we need to multiply the dimensions
            // of the metafile with to get the size in the control.

            _scaleFactor = ((double)height / DefaultSettings.Height) * Zoom;
        }
コード例 #40
0
ファイル: Panel.cs プロジェクト: uQr/referencesource
 /// <devdoc>
 ///    [To be supplied.]
 /// </devdoc>
 private void AddScrollingAttribute(ScrollBars scrollBars, HtmlTextWriter writer) {
     switch (scrollBars) {
         case ScrollBars.Horizontal:
             writer.AddStyleAttribute(HtmlTextWriterStyle.OverflowX, "scroll");
             break;
         case ScrollBars.Vertical:
             writer.AddStyleAttribute(HtmlTextWriterStyle.OverflowY, "scroll");
             break;
         case ScrollBars.Both:
             writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "scroll");
             break;
         case ScrollBars.Auto:
             writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "auto");
             break;
         default:
             break;
     }
 }
コード例 #41
0
ファイル: SWFTypeDecoders.cs プロジェクト: jozilla/Uiml.net
 public static string DecodeScrollBarsInverse(ScrollBars s)
 {
     return s.ToString();
 }