public void HorizontalEqualsMaxPercentage() { FwSplitContainer splitContainer = new FwSplitContainer(); splitContainer.Orientation = Orientation.Horizontal; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 70% should be allowed SplitterCancelEventArgs e = new SplitterCancelEventArgs(50, 70, 50, 70); splitContainer.OnSplitterMoving(e); Assert.IsFalse(e.Cancel); }
public void HorizontalGreaterThenMaxPercentage() { FwSplitContainer splitContainer = new FwSplitContainer(); splitContainer.Orientation = Orientation.Horizontal; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 90% should leave splitter at 70% SplitterCancelEventArgs e = new SplitterCancelEventArgs(50, 90, 50, 90); splitContainer.OnSplitterMoving(e); Assert.AreEqual((int)(splitContainer.Height * splitContainer.MaxFirstPanePercentage), e.SplitY); }
public bool SeparatorMoving(Point mouse, Point splitter) { // Fire the event that indicates the splitter is being moved SplitterCancelEventArgs e = new SplitterCancelEventArgs(mouse.X, mouse.Y, splitter.X, splitter.Y); OnSplitterMoving(e); // Tell caller if the movement should be cancelled or not return e.Cancel; }
private void OnSplitterMoving(object sender, SplitterCancelEventArgs e) { this.initialSplitterDist = this.splitContainer.SplitterDistance; if (this.InheritanceAttribute != InheritanceAttribute.InheritedReadOnly) { this.disabledGlyphs = true; Adorner bodyGlyphAdorner = null; SelectionManager service = (SelectionManager) this.GetService(typeof(SelectionManager)); if (service != null) { bodyGlyphAdorner = service.BodyGlyphAdorner; } foreach (Adorner adorner2 in base.BehaviorService.Adorners) { if ((bodyGlyphAdorner == null) || !adorner2.Equals(bodyGlyphAdorner)) { adorner2.EnabledInternal = false; } } base.BehaviorService.Invalidate(); ArrayList list = new ArrayList(); foreach (ControlBodyGlyph glyph in bodyGlyphAdorner.Glyphs) { if (!(glyph.RelatedComponent is SplitterPanel)) { list.Add(glyph); } } foreach (Glyph glyph2 in list) { bodyGlyphAdorner.Glyphs.Remove(glyph2); } } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!IsSplitterFixed && IsSplitterMovable) { //change cursor if default and user hasnt changed the cursor. if (Cursor == DefaultCursor && SplitterRectangle.Contains(e.Location)) { if (Orientation == Orientation.Vertical) { OverrideCursor = Cursors.VSplit; } else { OverrideCursor = Cursors.HSplit; } } else { OverrideCursor = null;; } if (splitterClick) { int x = e.X ; int y = e.Y ; splitterDrag = true; SplitMove(x, y); if (Orientation == Orientation.Vertical) { x = Math.Max(Math.Min(x, Width - Panel2MinSize), Panel1MinSize); y = Math.Max(y, 0); } else { y = Math.Max(Math.Min(y, Height - Panel2MinSize), Panel1MinSize); x = Math.Max(x, 0); } Rectangle r = CalcSplitLine(GetSplitterDistance(e.X, e.Y), 0); int xSplit = r.X; int ySplit = r.Y; SplitterCancelEventArgs se = new SplitterCancelEventArgs(x, y, xSplit, ySplit); OnSplitterMoving(se); if (se.Cancel) { SplitEnd(false); } } } }
private void TwoPanelContainer_SplitterMoving(object sender, SplitterCancelEventArgs e) { this.NewSplitterPercent = -1; if (this.HintTooltip != null) { double num; if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { num = (e.SplitX * 100f) / ((float) (base.Panel1.Width + base.Panel2.Width)); } else { num = (e.SplitY * 100f) / ((float) (base.Panel1.Height + base.Panel2.Height)); } this.HintTooltip.Show(string.Format("{0:0.0}%", num), this, e.MouseCursorX, e.MouseCursorY + this.Cursor.GetPrefferedHeight()); } }
private void OnDockspaceSeparatorMoving(object sender, SplitterCancelEventArgs e) { if (SplitterMoving != null) SplitterMoving(sender, e); }
private void zkSplitContainer1_SplitterMoving(object sender, SplitterCancelEventArgs e) { gameBox.Left = 0; //anchor gameBox to zkSplitContainer slider }
private void SptNavigationSplitterMoving(object sender, System.Windows.Forms.SplitterCancelEventArgs e) { // TODO: hide lowest folder radio button, add it to panel pnlMoreButtons }
private void OnSlidePanelSeparatorMoving(object sender, SplitterCancelEventArgs e) { }
void OnSplitterMoving(object sender, SplitterCancelEventArgs e) { if (Collapsed) e.Cancel = true; }
private void BrowserSplitter_Moving(object sender, SplitterCancelEventArgs e) { splitterPos = e.SplitX; }
private void c_scWorldMetadata_SplitterMoving(object sender, SplitterCancelEventArgs e) { c_oWorldWindow.Visible = false; }
private void splitContainer1_SplitterMoving(object sender, SplitterCancelEventArgs e) { refresh(); }
private void splitContainer1_SplitterMoving(object sender, SplitterCancelEventArgs e) { _userWantsUpdateSplitterPosition = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the user moves the splitter. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:System.Windows.Forms.SplitterCancelEventArgs"/> /// instance containing the event data.</param> /// ------------------------------------------------------------------------------------ protected void OnSplitterMoving(object sender, SplitterCancelEventArgs e) { if (m_maxFirstPanePercentage <= 0 || m_maxFirstPanePercentage > 1) return; if (Orientation == Orientation.Horizontal) { if ((float)e.SplitY > (float)(Height * m_maxFirstPanePercentage) && Height > 0) e.SplitY = (int)(Height * m_maxFirstPanePercentage); } else { if ((float)e.SplitX > (float)(Width * m_maxFirstPanePercentage) && Width > 0) e.SplitX = (int)(Width * m_maxFirstPanePercentage); } }
private void topSplit_SplitterMoving(object sender, SplitterCancelEventArgs e) { ignoreSplitterMoved = false; }
public void OnSplitterMoving(SplitterCancelEventArgs e) { throw null; }
void splitContainer1_SplitterMoving (object sender, SplitterCancelEventArgs e) { if (checkBox3.Checked) e.Cancel = true; }
/// <summary> /// Raises the SplitterMoving event. /// </summary> /// <param name="e">A SplitterEventArgs containing the event data.</param> protected virtual void OnSplitterMoving(SplitterCancelEventArgs e) { if (SplitterMoving != null) SplitterMoving(this, e); }
private void splitContainer2_SplitterMoving(object sender, SplitterCancelEventArgs e) { splitterMoved = true; }
private void splitContainer_SplitterMoving(object sender, SplitterCancelEventArgs e) { //ShowSpliToolTip(e.MouseCursorX, e.MouseCursorY, e.SplitX); }
public void VerticalGreaterThenMaxPercentage() { using (FwSplitContainer splitContainer = new FwSplitContainer()) { splitContainer.Orientation = Orientation.Vertical; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 90% should leave splitter at 70% SplitterCancelEventArgs e = new SplitterCancelEventArgs(90, 50, 90, 50); splitContainer.OnSplitterMoving(e); Assert.AreEqual((int)(splitContainer.Width * splitContainer.MaxFirstPanePercentage), e.SplitX); } }
public void TestSplitterCancelEventArgs() { int mx = 23; int my = 33; int sx = 43; int sy = 53; SplitterCancelEventArgs e = new SplitterCancelEventArgs(mx, my, sx, sy); Assert.AreEqual(mx, e.MouseCursorX, "A1"); Assert.AreEqual(my, e.MouseCursorY, "A2"); Assert.AreEqual(sx, e.SplitX, "A3"); Assert.AreEqual(sy, e.SplitY, "A4"); e.SplitX = 11; e.SplitY = 12; Assert.AreEqual(11, e.SplitX, "A5"); Assert.AreEqual(12, e.SplitY, "A6"); }
private void splitContainer1_SplitterMoving(System.Object sender, System.Windows.Forms.SplitterCancelEventArgs e) { // As the splitter moves, change the cursor type. Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert; }
private void splitContainer1_SplitterMoving(object sender, SplitterCancelEventArgs e) { Control ct = sender as Control; ct.Cursor = Cursors.VSplit; }
private void OnSplitterMoving(object sender,SplitterCancelEventArgs e) { try { this.lblToolbox.BackColor = this.lblPin.BackColor = SystemColors.ActiveCaption; this.lblToolbox.ForeColor = this.lblPin.ForeColor = SystemColors.ActiveCaptionText; if (this.tmrAutoHide.Enabled) { this.tmrAutoHide.Stop(); this.tmrAutoHide.Enabled = false; } } catch (Exception ex) { reportError(ex); } }
protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (this.IsSplitterMovable && !this.IsSplitterFixed) { if ((e.KeyData == Keys.Escape) && this.splitBegin) { this.splitBegin = false; this.splitBreak = true; } else if (((e.KeyData == Keys.Right) || (e.KeyData == Keys.Down)) || ((e.KeyData == Keys.Left) || ((e.KeyData == Keys.Up) && this.splitterFocused))) { if (this.splitBegin) { this.splitMove = true; } if ((e.KeyData == Keys.Left) || ((e.KeyData == Keys.Up) && this.splitterFocused)) { this.splitterDistance -= this.SplitterIncrement; this.splitterDistance = (this.splitterDistance < this.Panel1MinSize) ? (this.splitterDistance + this.SplitterIncrement) : Math.Max(this.splitterDistance, this.BORDERSIZE); } if ((e.KeyData == Keys.Right) || ((e.KeyData == Keys.Down) && this.splitterFocused)) { this.splitterDistance += this.SplitterIncrement; if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { this.splitterDistance = ((this.splitterDistance + this.SplitterWidth) > ((base.Width - this.Panel2MinSize) - this.BORDERSIZE)) ? (this.splitterDistance - this.SplitterIncrement) : this.splitterDistance; } else { this.splitterDistance = ((this.splitterDistance + this.SplitterWidth) > ((base.Height - this.Panel2MinSize) - this.BORDERSIZE)) ? (this.splitterDistance - this.SplitterIncrement) : this.splitterDistance; } } if (!this.splitBegin) { this.splitBegin = true; } if (this.splitBegin && !this.splitMove) { this.initialSplitterDistance = this.SplitterDistanceInternal; this.DrawSplitBar(1); } else { this.DrawSplitBar(2); Rectangle rectangle = this.CalcSplitLine(this.splitterDistance, 0); int x = rectangle.X; int y = rectangle.Y; SplitterCancelEventArgs args = new SplitterCancelEventArgs((base.Left + this.SplitterRectangle.X) + (this.SplitterRectangle.Width / 2), (base.Top + this.SplitterRectangle.Y) + (this.SplitterRectangle.Height / 2), x, y); this.OnSplitterMoving(args); if (args.Cancel) { this.SplitEnd(false); } } } } }
private void SplitterMoving(object sender, SplitterCancelEventArgs e) { // This event only comes up when the splitter is moved with the mouse (i.e. by the user). // We can use it to differentiate between user initiated and programmatic splitter changes. splitterMovePending = true; }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!this.IsSplitterFixed && this.IsSplitterMovable) { if ((this.Cursor == this.DefaultCursor) && this.SplitterRectangle.Contains(e.Location)) { if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { this.OverrideCursor = Cursors.VSplit; } else { this.OverrideCursor = Cursors.HSplit; } } else { this.OverrideCursor = null; } if (this.splitterClick) { int x = e.X; int y = e.Y; this.splitterDrag = true; this.SplitMove(x, y); if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { x = Math.Max(Math.Min(x, base.Width - this.Panel2MinSize), this.Panel1MinSize); y = Math.Max(y, 0); } else { y = Math.Max(Math.Min(y, base.Height - this.Panel2MinSize), this.Panel1MinSize); x = Math.Max(x, 0); } Rectangle rectangle = this.CalcSplitLine(this.GetSplitterDistance(e.X, e.Y), 0); int splitX = rectangle.X; int splitY = rectangle.Y; SplitterCancelEventArgs args = new SplitterCancelEventArgs(x, y, splitX, splitY); this.OnSplitterMoving(args); if (args.Cancel) { this.SplitEnd(false); } } } }
/// <include file='doc\SplitContainer.uex' path='docs/doc[@for="SplitContainer.OnKeyDown"]/*' /> /// <devdoc> /// Overrides the Control.OnKeydown for implementing splitter movements. /// </devdoc> protected override void OnKeyDown(KeyEventArgs e) { Debug.Assert(Enabled, "SplitContainer.OnKeyDown should not be called if the button is disabled"); base.OnKeyDown(e); //If the Panel1MinSize + Panel2MinSize < SplitContainer.Size then carry on the splitter move... if (IsSplitterMovable && !IsSplitterFixed) { if (e.KeyData == Keys.Escape && splitBegin) { splitBegin = false; splitBreak = true; return; } //valid Keys that move the splitter... if (e.KeyData == Keys.Right || e.KeyData == Keys.Down || e.KeyData == Keys.Left || e.KeyData == Keys.Up && splitterFocused) { if (splitBegin) { splitMove = true; } //left OR up if (e.KeyData == Keys.Left || e.KeyData == Keys.Up && splitterFocused) { splitterDistance -= SplitterIncrement; splitterDistance = (splitterDistance < Panel1MinSize) ? splitterDistance + SplitterIncrement : Math.Max(splitterDistance, BORDERSIZE); } //right OR down if (e.KeyData == Keys.Right || e.KeyData == Keys.Down && splitterFocused) { splitterDistance += SplitterIncrement; if (Orientation == Orientation.Vertical) { splitterDistance = (splitterDistance + SplitterWidth > Width - Panel2MinSize -BORDERSIZE) ? splitterDistance - SplitterIncrement : splitterDistance; } else { splitterDistance = (splitterDistance + SplitterWidth > Height - Panel2MinSize - BORDERSIZE) ? splitterDistance - SplitterIncrement : splitterDistance; } } if (!splitBegin) { splitBegin = true; } //draw Helper start if (splitBegin && !splitMove) { initialSplitterDistance = SplitterDistanceInternal; DrawSplitBar(DRAW_START); } else { //draw helper move DrawSplitBar(DRAW_MOVE); //Moving by mouse .....gives the origin of the splitter.. // Rectangle r = CalcSplitLine(splitterDistance, 0); int xSplit = r.X; int ySplit = r.Y; SplitterCancelEventArgs se = new SplitterCancelEventArgs(this.Left + SplitterRectangle.X + SplitterRectangle.Width/2, this.Top + SplitterRectangle.Y + SplitterRectangle.Height/2, xSplit, ySplit); OnSplitterMoving(se); if (se.Cancel) { SplitEnd(false); } } } //End Valid Keys.... } //End SplitterFixed Check... }
public void OnSplitterMoving (SplitterCancelEventArgs e) { SplitterCancelEventHandler eh = (SplitterCancelEventHandler)(Events [SplitterMovingEvent]); if (eh != null) eh (this, e); }
/// <include file='doc\SplitContainer.uex' path='docs/doc[@for="SplitContainer.OnSplitterMoving"]/*' /> /// <devdoc> /// Inherriting classes should override this method to respond to the /// splitterMoving event. This event occurs while the splitter is /// being moved by the user. /// </devdoc> public void OnSplitterMoving(SplitterCancelEventArgs e) { SplitterCancelEventHandler handler = (SplitterCancelEventHandler)Events[EVENT_MOVING]; if (handler != null) handler(this, e); }
private void splitContainer1_SplitterMoving(System.Object sender, System.Windows.Forms.SplitterCancelEventArgs e) { // Define what happens while the splitter is moving. Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert; }