/// <summary> /// Initializes some important variables /// </summary> private void InitState() { // calculate number of lines required (being careful to count 1 for the last partial line) _linesCount = (_dataBuf.Length + _columnCount - 1) / _columnCount; _startLine = 0; if (_linesCount > _rowCount) { _displayLinesCount = _rowCount; _scrollBar.Hide(); _scrollBar.Maximum = _linesCount - 1; _scrollBar.LargeChange = _rowCount; _scrollBar.Show(); _scrollBar.Enabled = true; } else { _displayLinesCount = _linesCount; _scrollBar.Hide(); _scrollBar.Maximum = _rowCount; _scrollBar.LargeChange = _rowCount; _scrollBar.Show(); _scrollBar.Enabled = false; } _scrollBar.Select(); Invalidate(); }
/// <include file='doc\ByteViewer.uex' path='docs/doc[@for="ByteViewer.InitState"]/*' /> /// <devdoc> /// Initializes some important variables /// </devdoc> /// <internalonly/> private void InitState() { // calculate number of lines required (being careful to count 1 for the last partial line) linesCount = (dataBuf.Length + columnCount - 1) / columnCount; startLine = 0; if (linesCount > rowCount) { displayLinesCount = rowCount; scrollBar.Hide(); scrollBar.Maximum = linesCount - 1; scrollBar.LargeChange = rowCount; scrollBar.Show(); scrollBar.Enabled = true; } else { displayLinesCount = linesCount; scrollBar.Hide(); scrollBar.Maximum = rowCount; scrollBar.LargeChange = rowCount; scrollBar.Show(); scrollBar.Enabled = false; } scrollBar.Select(); Invalidate(); }
/// <summary> /// Change of the slot type. /// </summary> void CbxIndicatorSlot_SelectedIndexChanged(object sender, EventArgs e) { currentSlotType = (SlotTypes)(Enum.GetValues(typeof(SlotTypes)).GetValue(cbxIndicatorSlot.SelectedIndex + 1)); ArrangeIndicatorsSlots(); SetStatusButton(); SetVerticalScrollBar(); vScrollBar.Select(); }
/// <summary> /// Selects a row on Mouse Up /// </summary> protected override void OnMouseUp(MouseEventArgs e) { _selectedRow = e.Y / _rowHeight - 2; if (_selectedRow < 0) { _selectedRow = 0; } else if (_selectedRow > _shownBars - 1) { _selectedRow = _shownBars - 1; } var rect = new Rectangle(0, 2 * _rowHeight, ClientSize.Width, ClientSize.Height - 2 * _rowHeight); Invalidate(rect); VScrollBar.Select(); }
/// <summary> /// Selects a row on Mouse Up /// </summary> protected override void OnMouseUp(MouseEventArgs e) { selectedRow = e.Y / rowHeight - 2; if (selectedRow < 0) { selectedRow = 0; } else if (selectedRow > shownBars - 1) { selectedRow = shownBars - 1; } Rectangle rect = new Rectangle(0, 2 * rowHeight, ClientSize.Width, ClientSize.Height - 2 * rowHeight); Invalidate(rect); vScrollBar.Select(); }
/// <summary> /// Selects the vertical scrollbar /// </summary> private void InfoPanelMouseUp(object sender, MouseEventArgs e) { _vScrollBar.Select(); }
/// <summary> /// Selects the vertical scrollbar /// </summary> void Info_Panel_MouseUp(object sender, MouseEventArgs e) { vScrollBar.Select(); }
/// <summary> /// Selects the vertical scroll bar. /// </summary> public void SelectVScrollBar() { vScrollBar.Select(); }
/// <summary> /// Constructor /// </summary> public IndicatorsLayout() { bannedEntryFilterIndicators = new List <string>(); bannedEntryIndicators = new List <string>(); bannedExitFilterIndicators = new List <string>(); bannedExitIndicators = new List <string>(); tsIndLayout = new ToolStrip(); layoutBase = new Panel(); flowLayoutIndicators = new FlowLayoutPanel(); vScrollBar = new VScrollBar(); cbxIndicatorSlot = new ToolStripComboBox(); tsIndLayout.CanOverflow = false; cbxIndicatorSlot.DropDownStyle = ComboBoxStyle.DropDownList; cbxIndicatorSlot.AutoSize = false; var items = new[] { Language.T("Opening Point of the Position"), Language.T("Opening Logic Condition"), Language.T("Closing Point of the Position"), Language.T("Closing Logic Condition") }; foreach (string item in items) { cbxIndicatorSlot.Items.Add(item); } cbxIndicatorSlot.SelectedIndex = 0; cbxIndicatorSlot.SelectedIndexChanged += CbxIndicatorSlotSelectedIndexChanged; tsbtnSelectAll = new ToolStripButton { Name = "tsbtnSelectAll", DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Resources.optimizer_select_all, ToolTipText = Language.T("Allow all indicators."), Alignment = ToolStripItemAlignment.Right }; tsbtnSelectAll.Click += ButtonsClick; tsbtnSelectNone = new ToolStripButton { Name = "tsbtnSelectNone", DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Resources.optimizer_select_none, ToolTipText = Language.T("Ban all indicators."), Alignment = ToolStripItemAlignment.Right }; tsbtnSelectNone.Click += ButtonsClick; tsbtnStatus = new ToolStripButton { Name = "tsbtnStatus", Text = Language.T("banned"), Alignment = ToolStripItemAlignment.Right }; tsbtnStatus.Click += ButtonsClick; tsIndLayout.Items.Add(cbxIndicatorSlot); tsIndLayout.Items.Add(tsbtnStatus); tsIndLayout.Items.Add(tsbtnSelectNone); tsIndLayout.Items.Add(tsbtnSelectAll); // Layout base layoutBase.Parent = this; layoutBase.Dock = DockStyle.Fill; layoutBase.BackColor = LayoutColors.ColorControlBack; layoutBase.ForeColor = LayoutColors.ColorControlText; // Tool Strip Strategy tsIndLayout.Parent = this; tsIndLayout.Dock = DockStyle.Top; // flowLayoutIndicators flowLayoutIndicators.Parent = layoutBase; flowLayoutIndicators.AutoScroll = false; flowLayoutIndicators.AutoSize = true; flowLayoutIndicators.FlowDirection = FlowDirection.TopDown; flowLayoutIndicators.BackColor = LayoutColors.ColorControlBack; flowLayoutIndicators.ForeColor = LayoutColors.ColorControlText; // VScrollBarStrategy vScrollBar.Parent = layoutBase; vScrollBar.TabStop = true; vScrollBar.Scroll += VScrollBarScroll; InitBannedIndicators(); SetStatusButton(); ArrangeIndicatorsSlots(); vScrollBar.Select(); }
/// <summary> /// Constructor /// </summary> public IndicatorsLayout() { tsIndLayout = new ToolStrip(); layoutBase = new Panel(); flowLayoutIndicators = new FlowLayoutPanel(); vScrollBar = new VScrollBar(); cbxIndicatorSlot = new ToolStripComboBox(); tsIndLayout.CanOverflow = false; cbxIndicatorSlot.DropDownStyle = ComboBoxStyle.DropDownList; cbxIndicatorSlot.AutoSize = false; cbxIndicatorSlot.Items.AddRange(new string[] { Language.T("Opening Point of the Position"), Language.T("Opening Logic Condition"), Language.T("Closing Point of the Position"), Language.T("Closing Logic Condition") }); cbxIndicatorSlot.SelectedIndex = 0; cbxIndicatorSlot.SelectedIndexChanged += new EventHandler(CbxIndicatorSlot_SelectedIndexChanged); tsbtnSelectAll = new ToolStripButton(); tsbtnSelectAll.Name = "tsbtnSelectAll"; tsbtnSelectAll.Click += new EventHandler(Buttons_Click); tsbtnSelectAll.DisplayStyle = ToolStripItemDisplayStyle.Image; tsbtnSelectAll.Image = Properties.Resources.optimizer_select_all; tsbtnSelectAll.ToolTipText = Language.T("Allow all indicators."); tsbtnSelectAll.Alignment = ToolStripItemAlignment.Right; tsbtnSelectNone = new ToolStripButton(); tsbtnSelectNone.Name = "tsbtnSelectNone"; tsbtnSelectNone.Click += new EventHandler(Buttons_Click); tsbtnSelectNone.DisplayStyle = ToolStripItemDisplayStyle.Image; tsbtnSelectNone.Image = Properties.Resources.optimizer_select_none; tsbtnSelectNone.ToolTipText = Language.T("Bann all indicators."); tsbtnSelectNone.Alignment = ToolStripItemAlignment.Right; tsbtnStatus = new ToolStripButton(); tsbtnStatus.Name = "tsbtnStatus"; tsbtnStatus.Text = Language.T("banned"); tsbtnStatus.Click += new EventHandler(Buttons_Click); tsbtnStatus.Alignment = ToolStripItemAlignment.Right; tsIndLayout.Items.Add(cbxIndicatorSlot); tsIndLayout.Items.Add(tsbtnStatus); tsIndLayout.Items.Add(tsbtnSelectNone); tsIndLayout.Items.Add(tsbtnSelectAll); // Layout base layoutBase.Parent = this; layoutBase.Dock = DockStyle.Fill; layoutBase.BackColor = LayoutColors.ColorControlBack; // Tool Strip Strategy tsIndLayout.Parent = this; tsIndLayout.Dock = DockStyle.Top; // flowLayoutIndicators flowLayoutIndicators.Parent = layoutBase; flowLayoutIndicators.AutoScroll = false; flowLayoutIndicators.AutoSize = true; flowLayoutIndicators.FlowDirection = FlowDirection.TopDown; flowLayoutIndicators.BackColor = LayoutColors.ColorControlBack; // VScrollBarStrategy vScrollBar.Parent = layoutBase; vScrollBar.TabStop = true; vScrollBar.Scroll += new ScrollEventHandler(VScrollBar_Scroll); InitBannedIndicators(); SetStatusButton(); ArrangeIndicatorsSlots(); vScrollBar.Select(); }