protected override void WndProc(ref Message m) { if (m.Msg == WM_VSCROLL) { GetScrollPosition(out int min, out int max, out int pos, out int smallchange, out int largechange); ScrollPositionChanged?.Invoke(this, pos); if (_vScrollbar != null) { _vScrollbar.Value = pos; } } else if (m.Msg == WM_NCCALCSIZE) // WM_NCCALCSIZE { int style = (int)GetWindowLong(this.Handle, GWL_STYLE); if ((style & WS_VSCROLL) == WS_VSCROLL) { SetWindowLong(this.Handle, GWL_STYLE, style & ~WS_VSCROLL); } } else if (m.Msg == LVM_INSERTITEMA || m.Msg == LVM_INSERTITEMW) { OnItemAdded(); } else if (m.Msg == LVM_DELETEITEM || m.Msg == LVM_DELETEALLITEMS) { OnItemsRemoved(); } base.WndProc(ref m); }
protected override void OnResize(EventArgs e) { base.OnResize(e); this.ScrollPosition = this.ScrollPosition; UpdateHorizontalScrollWidth(); ScrollPositionChanged?.Invoke(this, e); }
private void ctrlTextbox_ScrollPositionChanged(object sender, EventArgs e) { this.vScrollBar.Value = this.ctrlTextbox.ScrollPosition; this.hScrollBar.Value = this.ctrlTextbox.HorizontalScrollPosition; UpdateHorizontalScrollbar(); UpdateVerticalScrollbar(); ScrollPositionChanged?.Invoke(null, null); }
/// <summary> /// An application-defined function that processes messages sent to a window. /// </summary> /// <param name="message"> /// System defined windows message. /// </param> protected override void WndProc(ref Message message) { if (message.Msg == WM_VSCROLL || message.Msg == WM_MOUSEWHEEL || LoWord(message.WParam) == (int)ScrollBarCommands.SB_LINEUP || LoWord(message.WParam) == (int)ScrollBarCommands.SB_LINEDOWN || LoWord(message.WParam) == (int)ScrollBarCommands.SB_PAGEUP || LoWord(message.WParam) == (int)ScrollBarCommands.SB_PAGEDOWN || LoWord(message.WParam) == (int)ScrollBarCommands.SB_THUMBTRACK || LoWord(message.WParam) == (int)ScrollBarCommands.SB_THUMBPOSITION) { // Update immediate position of the scrollbar returned by the function // 'GetScrollbarPosition' in the label 'lbScrollbarPosition'. ScrollPositionChanged?.Invoke(this, new ScrollEventArgs(ScrollEventType.EndScroll, GetScrollbarPosition())); } base.WndProc(ref message); }
public void MoveSelectionUp(int lines = 1) { _disableScrollPositionChangedEvent = true; while (lines > 0) { bool singleLineSelection = this.SelectionLength == 0; if (singleLineSelection) { if (this.SelectionStart == 0) { //Top of document reached break; } this.SelectionStart--; this.SelectedLine = this.SelectionStart; this.SelectionLength++; } else if (this.SelectionStart == this.SelectedLine) { if (this.SelectionStart == 0) { //Top of document reached break; } this.SelectionStart--; this.SelectedLine--; this.SelectionLength++; } else { this.SelectedLine--; this.SelectionLength--; } lines--; } _disableScrollPositionChangedEvent = false; ScrollPositionChanged?.Invoke(this, null); }
public void MoveSelectionDown(int lines = 1) { _disableScrollPositionChangedEvent = true; while (lines > 0) { bool singleLineSelection = this.SelectionLength == 0; if (singleLineSelection) { if (this.SelectionStart + this.SelectionLength >= this._contents.Length - 1) { //End of document reached break; } this.SelectedLine = this.SelectionStart + 1; this.SelectionLength++; } else if (this.SelectionStart + this.SelectionLength == this.SelectedLine) { if (this.SelectionStart + this.SelectionLength >= this._contents.Length - 1) { //End of document reached break; } this.SelectedLine++; this.SelectionLength++; } else { this.SelectionStart++; this.SelectedLine++; this.SelectionLength--; } lines--; } _disableScrollPositionChangedEvent = false; ScrollPositionChanged?.Invoke(this, null); }
private void OnScrollPositionChanged() { ScrollPositionChanged?.Invoke(this, null); }
private void OnScrollPositionChanged() { ScrollPositionChanged?.Invoke(this, EventArgs.Empty); Invalidate(); }
public void Scrolled(UIScrollView scrollView) { ScrollPositionChanged?.Invoke(this, scrollView.ContentOffset.Y); }