Пример #1
0
        protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
        {
            try
            {
                //splitContainerScaling = true;
                base.ScaleControl(factor, specified);

                float scale;
                if (Orientation == Orientation.Vertical)
                {
                    scale = factor.Width;
                }
                else
                {
                    scale = factor.Height;
                }

                Panel1MinSize = (int)Math.Round((float)Panel1MinSize * scale);
                Panel2MinSize = (int)Math.Round((float)Panel2MinSize * scale);
                SplitterDistance = (int)Math.Round((float)SplitterDistance * scale);
            }
            finally
            {
                //splitContainerScaling = false;
            }
        }
Пример #2
0
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            if (AutoSize)
                height = _height;

            base.SetBoundsCore(x, y, width, height, specified);
        }
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     if (this.Scalable)
     {
         base.ScaleControl(factor, specified);
     }
 }
Пример #4
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if (specified == BoundsSpecified.All)
         base.SetBoundsCore(x, y, width , height, specified);
     else
         base.SetBoundsCore(x, y, width, height, specified);
 }
Пример #5
0
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            int nLimitHeight = this.TextBox.Height * 2 + 4;
            if (height > nLimitHeight)
                height = nLimitHeight;

            base.SetBoundsCore(x, y, width, height, specified);
        }
Пример #6
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if (!(_LockWidth == 0))
         width = _LockWidth;
     if (!(_LockHeight == 0))
         height = _LockHeight;
     base.SetBoundsCore(x, y, width, height, specified);
 }
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     this.descriptionTextBox.scaleList(factor);
     if (factor.Height > 1)
     {
         textBoxDuration.Top = (Height / 2) - (textBoxDuration.Height / 2);
     }
 }
 protected virtual void SetBoundsCore(Rectangle bounds, BoundsSpecified specified)
 {
     if (bounds != this.bounds)
     {
         Rectangle oldBounds = this.bounds;
         this.bounds = bounds;
         this.OnBoundsChanged(oldBounds, bounds);
     }
 }
Пример #9
0
        /// <summary>
        /// Sets the bounds of the control.
        /// </summary>
        /// <param name="x">The new left position.</param>
        /// <param name="y">The new top position.</param>
        /// <param name="width">The new width.</param>
        /// <param name="height">The new height.</param>
        /// <param name="specified">Which of the bounds should be set.</param>
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            if ((specified & BoundsSpecified.Height) == BoundsSpecified.Height)
            {
                height = this.PreferredHeight;
            }

            base.SetBoundsCore(x, y, width, height, specified);
        }
Пример #10
0
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            base.SetBoundsCore(x, y, width, height, specified);

            int h = GetItemHeight();
            int n = itemsHolder.Controls.Count;
            for (int i = 0; i < n; i++)
                itemsHolder.Controls[i].Height = h;
        }
Пример #11
0
		protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
		{
			if(Dock != DockStyle.None && AutoSize )
			{
		  Size	s = base.GetPreferredSize(new Size(1, 1));
			 base.SetBoundsCore(x, y, s.Width, s.Height, specified);
			}
			else
				base.SetBoundsCore(x, y, width, height, specified);
		}
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if (this.AutoSize & ((specified & BoundsSpecified.Size) > BoundsSpecified.None))
     {
         Size preferredSize = base.PreferredSize;
         width = preferredSize.Width;
         height = preferredSize.Height;
     }
     base.SetBoundsCore(x, y, width, height, specified);
 }
Пример #13
0
        protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
        {
            base.ScaleControl(factor, specified);

            const float baseDpi = 96.0f;

            this.CurrentScaleFactor = new SizeF(
                this.CurrentAutoScaleDimensions.Width / baseDpi,
                this.CurrentAutoScaleDimensions.Height / baseDpi);
        }
Пример #14
0
 protected override void SetBoundsCore(int x, int y, int width, int height,
         BoundsSpecified specified)
 {
     if (AutoSize && (specified & BoundsSpecified.Size) != 0)
     {
         var size = GetAutoSize();
         width = size.Width;
         height = size.Height;
     }
     base.SetBoundsCore(x, y, width, height, specified);
 }
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if ((BoundsSpecified.Width & specified) == BoundsSpecified.Width)
     {
         width = Math.Max(width, 100);
     }
     if ((BoundsSpecified.Height & specified) == BoundsSpecified.Height)
     {
         height = Math.Max(height, 90);
     }
     base.SetBoundsCore(x, y, width, height, specified);
 }
Пример #16
0
		/// <summary>
		/// Performs the work of setting the
		/// specified bounds of this control.
		/// </summary>
		/// <param name="x">The new <see cref="P:System.Windows.Forms.Control.Left"/> property value of the control.</param>
		/// <param name="y">The new <see cref="P:System.Windows.Forms.Control.Right"/> property value of the control.</param>
		/// <param name="width">The new <see cref="P:System.Windows.Forms.Control.Width"/> property value of the control.</param>
		/// <param name="height">The new <see cref="P:System.Windows.Forms.Control.Height"/> property value of the control.</param>
		/// <param name="specified">A bitwise combination of the <see cref="T:System.Windows.Forms.BoundsSpecified"/> values.</param>
		protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
		{
			if ((specified & BoundsSpecified.Height) != 0)
			{
				if (height != SystemInformation.Border3DSize.Height)
				{
					height = SystemInformation.Border3DSize.Height;
				}
			}

			base.SetBoundsCore (x, y, width, height, specified);
		}
Пример #17
0
        protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
        {
            base.ScaleControl(factor, specified);
            splitContainer1.SplitterDistance = (int)(splitContainer1.SplitterDistance * factor.Width);
            splitContainer2.SplitterDistance = (int)(splitContainer2.SplitterDistance * factor.Width);
            splitContainer2.Panel1MinSize = (int)(splitContainer2.Panel1MinSize * factor.Width);

            splitContainer3.SplitterDistance = (int)(splitContainer3.SplitterDistance * factor.Height);
            splitContainer4.SplitterDistance = (int)(splitContainer4.SplitterDistance * factor.Height);

            _scaleFactorX *= factor.Width;
            _scaleFactorY *= factor.Height;
        }
Пример #18
0
		// The size of the tab page is set by the parent
		protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) 
		{
			if (Parent != null)
			{
				Rectangle fix = (base.Parent as TabControl).DisplayRectangle;
				// Only change the size if we have to.
				if (fix != Bounds)
				{
					base.SetBoundsCore(fix.X, fix.Y, fix.Width, fix.Height, BoundsSpecified.All);
				}
			}
			else
				base.SetBoundsCore(x, y, width, height, specified);
		}
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            int verticalScrollWidth = 0;
            int horizontalScrollWidth = 0;

            if (_isVerticalScrollHidden)
            {
                verticalScrollWidth = this.Size.Width - this.ClientSize.Width + 2;
            }
            if (_isHorizontalScrollHidden)
            {
                horizontalScrollWidth = this.Size.Height - this.ClientSize.Height + 2;
            }

            base.SetBoundsCore(x, y, width + verticalScrollWidth, height + horizontalScrollWidth, specified);
        }
Пример #20
0
		/// <summary>
		/// </summary>
		protected override void SetBounds(int x, int y, int width, int height, BoundsSpecified specified)
		{
			if ((specified & BoundsSpecified.Width) != BoundsSpecified.None)
			{
				width = Math.Min(200, Math.Max(2, width));
				base.SetBounds(x, y, width, height, specified);

				if (this.Owner != null)
				{
					this.Owner.MeasureButtons();
					this.Owner.Refresh();
				}
			}
			else
			{
				base.SetBounds(x, y, width, height, specified);
			}
		}
Пример #21
0
 /// <summary>Sets the specified bounds of the System.Windows.Forms.TextBoxBase control.</summary>
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if (x != Left || y != Top || width != Width || height != Height)
     {
         if (Multiline && WordWrap)
         {
             int newHeight;
             if (_lastWidth != 0 && width == _lastWidth)
                 newHeight = _lastWidthResult;
             else
             {
                 newHeight = SizeFromClientSize(TextRenderer.MeasureText(Text.Length > 0 ? Text : "Wg", Font, new Size(width - Margin.Horizontal - Padding.Horizontal, height), TextFormatFlags.WordBreak)).Height;
                 _lastWidthResult = newHeight;
                 _lastWidth = width;
             }
             base.SetBoundsCore(x, y, width, newHeight + Margin.Vertical, BoundsSpecified.All);
         }
         else
             base.SetBoundsCore(x, y, width, height, specified);
     }
 }
Пример #22
0
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            if ((specified & BoundsSpecified.Size) != 0)
            {
                if (_window != null)
                {
                    Size size;
                    ErrorUtil.ThrowOnFailure(_window.GetPreferredSize(
                        new Size(width, height), out size
                    ));

                    width = size.Width;
                    height = size.Height;
                }
                else if (_designMode)
                {
                    height = 23;
                }
            }

            base.SetBoundsCore(x, y, width, height, specified);
        }
Пример #23
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     selectionListBox.ItemHeight = (int)(13 * factor.Height);
     base.ScaleControl(factor, specified);
 }
Пример #24
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     ScaleChildControl(this.EventList, factor);
 }
Пример #25
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     ScaleListViewColumns(lvCleanupHandlers, factor);
 }
        internal protected virtual void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            if (this.UseNewLayoutSystem)
            {
                Size desiredSize    = new Size(width, height);
                bool performMeasure = true;
                desiredSize = PerformInnerLayout(performMeasure, x, y, width, height);

                this.ComponentTreeHandler.CallSetBoundsCore(x, y, desiredSize.Width, desiredSize.Height, specified);
            }
            else
            {
                this.ComponentTreeHandler.CallSetBoundsCore(x, y, width, height, specified);
            }
        }
Пример #27
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     base.SetBoundsCore(x, y, ScaleX(_backgroundBitmap.Width), ScaleY(_backgroundBitmap.Height), specified);
 }
Пример #28
0
        protected override void ScaleControl(SizeF factor, BoundsSpecified specified) {
            try
            {
                splitContainerScaling = true;
                base.ScaleControl(factor, specified);

                float scale;
                if (orientation == Orientation.Vertical) {
                    scale = factor.Width;
                }
                else {
                    scale = factor.Height;
                }
                SplitterWidth = (int)Math.Round((float)SplitterWidth * scale);
            }
            finally
            {
                splitContainerScaling = false;
            }
        }
Пример #29
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     base.SetBoundsCore(x, y, width, height, specified);
 }
 public void SetBounds(int x, int y, int width, int height, BoundsSpecified specified)
 {
 }
Пример #31
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     ScaleChildControl(this.ListViewApi, factor);
 }
Пример #32
0
 /// <summary>
 ///  Scale this form.  Form overrides this to enforce a maximum / minimum size.
 /// </summary>
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     // never scale X and Y of an MDI client form
     specified &= ~BoundsSpecified.Location;
     base.ScaleControl(factor, specified);
 }
Пример #33
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     SaveScale(factor.Width, factor.Height);
     base.ScaleControl(factor, specified);
 }
Пример #34
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if (((specified & BoundsSpecified.Location) == BoundsSpecified.None) || !this.FreezeLocationChange)
     {
         base.SetBoundsCore(x, y, width, height, specified);
     }
 }
Пример #35
0
        ///  UpdateSpecifiedBounds
        ///  The main purpose of this function is to remember what size someone specified in the Size, Width, Height, Bounds
        ///  property.  (Its the whole reason the BoundsSpecified enum exists.)  Consider this scenario.  You set a Button
        ///  to DockStyle.Fill, then DockStyle.None.  When Dock.Filled, the Size changed to 300,300.  When you
        ///  set it back to DockStyle.None, the size switches back to 100,23.  How does this happen?
        ///
        ///  Setting the control to Dock.Fill (via DefaultLayout engine)
        ///  element.SetBounds(newElementBounds, BoundsSpecified.None);
        ///
        ///  (If someone happens to set the Size property here the specified bounds gets updated via Control.Size)
        ///  SetBounds(x, y, value.Width, value.Height, BoundsSpecified.Size);
        ///
        ///  Setting the control to Dock.None (via DefaultLayout.SetDock)
        ///  element.SetBounds(CommonProperties.GetSpecifiedBounds(element), BoundsSpecified.None);
        internal static void UpdateSpecifiedBounds(IArrangedElement element, int x, int y, int width, int height, BoundsSpecified specified)
        {
            Rectangle originalBounds = CommonProperties.GetSpecifiedBounds(element);

            // PERF note: Bitwise operator usage intentional to optimize out branching.

            bool xChangedButNotSpecified = ((specified & BoundsSpecified.X) == BoundsSpecified.None) & x != originalBounds.X;
            bool yChangedButNotSpecified = ((specified & BoundsSpecified.Y) == BoundsSpecified.None) & y != originalBounds.Y;
            bool wChangedButNotSpecified = ((specified & BoundsSpecified.Width) == BoundsSpecified.None) & width != originalBounds.Width;
            bool hChangedButNotSpecified = ((specified & BoundsSpecified.Height) == BoundsSpecified.None) & height != originalBounds.Height;

            if (xChangedButNotSpecified | yChangedButNotSpecified | wChangedButNotSpecified | hChangedButNotSpecified)
            {
                // if any of them are changed and specified cache the new value.

                if (!xChangedButNotSpecified)
                {
                    originalBounds.X = x;
                }

                if (!yChangedButNotSpecified)
                {
                    originalBounds.Y = y;
                }

                if (!wChangedButNotSpecified)
                {
                    originalBounds.Width = width;
                }

                if (!hChangedButNotSpecified)
                {
                    originalBounds.Height = height;
                }

                element.Properties.SetRectangle(_specifiedBoundsProperty, originalBounds);
            }
            else
            {
                // SetBoundsCore is going to call this a lot with the same bounds.  Avoid the set object
                // (which indirectly may causes an allocation) if we can.
                if (element.Properties.ContainsObject(_specifiedBoundsProperty))
                {
                    // use MaxRectangle instead of null so we can reuse the SizeWrapper in the property store.
                    element.Properties.SetRectangle(_specifiedBoundsProperty, LayoutUtils.MaxRectangle);
                }
            }
        }
Пример #36
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     OTBaseForm.ScaleChildControl(this.scrollBar, factor);
 }
Пример #37
0
 protected override void ScaleControl(System.Drawing.SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     CoreUtil.AdjustImages(this, ref _dpiOld, _form.DpiNew);
 }
Пример #38
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
 }
 protected override void SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
 {
     ShowLocation(string.Format("SetBoundsCore (x=<{0}>, y=<{1}>, width=<{2}>, height=<{3}>, specified=<{4}>) ", x, y, width, height, specified));
     base.SetBoundsCore(x, y, width, height, specified);;
 }
Пример #40
0
 public void PublicSetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     base.SetBoundsCore(x, y, width, height, specified);
 }
 public void SetBounds(int x, int y, int width, int height, BoundsSpecified specified)
 {
     this.SetBoundsCore(x, y, width, height, specified);
 }
        protected override void SetBoundsCore(int argX, int argY, int argWidth, int argHeight, BoundsSpecified specified)
        {
            // Fix location
            var workingArea = Screen.PrimaryScreen.WorkingArea;
            var newBounds   = WindowsFormsUtils.ConstrainToBounds(workingArea, new Rectangle(argX, argY, argWidth, argHeight));
            var xFixed      = argX != newBounds.X;

            // TODO: need some code to prevent child going outside of screen.

            /*if (OwnerItem != null)
             * {
             *  var parentDropDown = OwnerItem.Owner as ToolStripDropDown;
             *  if (parentDropDown != null && direction == ToolStripDropDownDirection.Right)
             *  {
             *      // TODO: need to add other direction. Should be ToolStripDropDownItem, but the problem is that
             *      // it's invoked after Graphics.MeasureString, which can only be done on paint thread.
             *      if (xFixed && newBounds.X + newBounds.Width - 2 >= parentDropDown.Location.X)
             *          newBounds = new Rectangle(parentDropDown.Location.X - argWidth + 2, newBounds.Y, newBounds.Width, newBounds.Height);
             *  }
             * }*/

            base.SetBoundsCore(newBounds.X, newBounds.Y, newBounds.Width, newBounds.Height, specified);
        }
Пример #43
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     base.SetBoundsCore(x, y, width, height, specified);
     this.webHost.Resize(width, height);
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Force the height of the control to be a bit larger than the tool strip.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            height = m_menuStrip.Height + 2;
//			height = m_toolstrip.PreferredSize.Height + 2;
            base.SetBoundsCore(x, y, width, height, specified);
        }
Пример #45
0
 public Rectangle PublicGetScaledBounds(Rectangle bounds, SizeF factor, BoundsSpecified specified)
 {
     return(base.GetScaledBounds(bounds, factor, specified));
 }
Пример #46
0
 private bool CanSetBounds(BoundsSpecified specified)
 {
     return
         (((specified & HorizontallySizeable) == HorizontallySizeable) ||
          ((specified & VerticallySizeable) == VerticallySizeable));
 }
Пример #47
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     this.popupSize = new Size(width, height);
     base.SetBoundsCore(x, y, width, height, specified);
 }
Пример #48
0
 public void SetBounds(Rectangle bounds, BoundsSpecified specified)
 {
     // in this case the parent is telling us to refresh our bounds - dont
     // call PerformLayout
     SetBoundsCore(bounds, specified);
 }
Пример #49
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     scMain.SplitterDistance = (int)Math.Round(scMain.SplitterDistance * factor.Width);
 }
 public void PublicScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
 }
Пример #51
0
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
     if (((specified & BoundsSpecified.Location) != 0) && FreezeLocationChange)
     {
         return;
     }
     base.SetBoundsCore(x, y, width, height, specified);
 }
Пример #52
0
        /// <summary>
        /// Override of ScaleControl which supports font scaling.
        /// </summary>
        /// <param name="factor">SizeF for the scale factor</param>
        /// <param name="specified">BoundsSpecified value.</param>
        protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
        {
            this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * factor.Height, this.Font.Style);

            base.ScaleControl(factor, specified);
        }
Пример #53
0
		public new void SetBounds(int x, int y, int width, int height, BoundsSpecified specified)
		{
			if(base.InvokeRequired)
			{
				this.Invoke(
					new UI.CtrlVoidFunc(UI.CallControlSetBounds),
					new object[] { this, 
									 new object[] { x, y, width, height, specified }});
			}
			else base.SetBounds(x, y, width, height, specified);
		}
Пример #54
0
        private void DrawSelectArea(int x1, int y1, int x2, int y2, BoundsSpecified bound)
        {
            bool      flag;
            Rectangle rectangle = new Rectangle(selArea.Location, selArea.Size);

            if (((bound & BoundsSpecified.Size) != BoundsSpecified.None) && this.blAreaVisible)
            {
                rectangle.Width  = x2;
                rectangle.Height = y2;
            }
            if (((bound & BoundsSpecified.Location) != BoundsSpecified.None) && this.blAreaVisible)
            {
                rectangle.X = x1;
                rectangle.Y = y1;
            }
            if (((x1 == 0) && (y1 == 0)) && ((x2 == 1) && (y2 == 1)))
            {
                flag = false;
            }
            else
            {
                flag = true;
            }
            selLineHor1.Visible = flag;
            selLineHor2.Visible = flag;
            selLineVer1.Visible = flag;
            selLineVer2.Visible = flag;
            selArea.Visible     = flag;
            selLineHor1.SetSelSize(x1 - this.targetScreen.Bounds.X, x2);
            if (selLineHor1.Top != y1)
            {
                selLineHor1.Top = y1;
            }
            selLineHor2.SetSelSize(x1 - this.targetScreen.Bounds.X, x2);
            if (selLineHor2.Top != (y1 + y2))
            {
                selLineHor2.Top = y1 + y2;
            }
            selLineVer1.SetSelSize(y1 - this.targetScreen.Bounds.Y, y2);
            if (selLineVer1.Left != x1)
            {
                selLineVer1.Left = x1;
            }
            selLineVer2.SetSelSize(y1 - this.targetScreen.Bounds.Y, y2);
            if (selLineVer2.Left != (x1 + x2))
            {
                selLineVer2.Left = x1 + x2;
            }
            if (this.blAreaVisible)
            {
                try
                {
                    selArea.SetBounds(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, BoundsSpecified.All);
                    selArea.Refresh();
                }
                catch (Exception exception)
                {
                    Console.WriteLine("CaptureForm DrawSelectArea Exception: " + exception.Message);
                }
            }
        }
Пример #55
0
 /// <summary>
 /// Applies constraint to bounding rectangle of canvas</summary>
 /// <param name="bounds">Unconstrained bounding rectangle</param>
 /// <param name="specified">Flags indicating which parts of bounding rectangle are meaningful</param>
 /// <returns>Constrained bounding rectangle</returns>
 Rectangle ILayoutConstraint.Constrain(Rectangle bounds, BoundsSpecified specified)
 {
     if (m_constraintEnabled)
     {
         if (bounds.X < m_bounds.X)
             bounds.X = m_bounds.X;
         else if (bounds.X >= m_bounds.Right)
             bounds.X = m_bounds.Right - 1;
         if (bounds.Y < m_bounds.Y)
             bounds.Y = m_bounds.Y;
         else if (bounds.Y >= m_bounds.Bottom)
             bounds.Y = m_bounds.Bottom - 1;
     }
     return bounds;
 }
Пример #56
0
 public override void InitLayout(object child, BoundsSpecified specified)
 {
     base.InitLayout(child, specified);
 }
Пример #57
0
        /// <include file='doc\SplitContainer.uex' path='docs/doc[@for="SplitContainer.SetBoundsCore"]/*' />
        /// <devdoc>
        ///     This protected override allows us to check is an unvalid value is set for Width and Height.
        ///     The SplitContainer would not throw on invalid Size (i.e Width and Height) settings, but would correct the error like Form
        ///     Say, the Panel1MinSize == 150 , Panel2MinSize == 50 and SplitterWidth == 4 and the user tries
        ///     to set SplitContainer.Width = 50 ... then this function would try to correct the value to 204.. instead of throwing.
        /// </devdoc>
        protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {

            // If we are changing Height, check if its greater than minimun else ... make it equal to the minimum
            if ((specified & BoundsSpecified.Height) != BoundsSpecified.None && Orientation == Orientation.Horizontal) {
                if (height < Panel1MinSize + SplitterWidthInternal + Panel2MinSize)
                {
                    height = Panel1MinSize + SplitterWidthInternal + Panel2MinSize;
                }
            }

            // If we are changing Width, check if its greater than minimun else ... make it equal to the minimum
            if ((specified & BoundsSpecified.Width) != BoundsSpecified.None && Orientation == Orientation.Vertical) {
                if (width < Panel1MinSize + SplitterWidthInternal + Panel2MinSize)
                {
                    width = Panel1MinSize + SplitterWidthInternal + Panel2MinSize;
                }
            }
            
            base.SetBoundsCore(x, y, width, height, specified);

            SetSplitterRect(this.Orientation == Orientation.Vertical);
        }
 public void SetBounds(int x, int y, int width, int height, BoundsSpecified specified)
 {
 }
Пример #59
0
Файл: Grid.cs Проект: kinpro/nfx
 protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
 {
   base.SetBoundsCore(x, y, width, height, specified);
   LayoutSubControls();
 }
Пример #60
0
 protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
 {
     base.ScaleControl(factor, specified);
     OTBaseForm.ScaleChildControl(this.scrollBar, factor);
 }