Scale() private method

private Scale ( SizeF factor ) : void
factor SizeF
return void
Ejemplo n.º 1
0
 public static void CallControlScale(Control c, object[] obj)
 {
     if (obj.Length == 1)
     {
         c.Scale((float)obj[0]);
     }
     else if (obj.Length == 2)
     {
         c.Scale((float)obj[0], (float)obj[1]);
     }
 }
Ejemplo n.º 2
0
 public static void CallControlScale(Control c, object[] obj)
 {
     if (obj.Length == 1)
     {
         c.Scale((System.Drawing.SizeF)obj[0]);
     }
 }
Ejemplo n.º 3
0
        internal static sys.Control ForceAutoScale(this sys.Control control)
        {
            var   graphics      = control.CreateGraphics();
            float scalingFactor = graphics.DpiY / 96; //96 DPI corresponds to 100% scaling

            control.Scale(new SizeF(scalingFactor, scalingFactor));
            return(control);
        }
Ejemplo n.º 4
0
		public static void CallControlScale(Control c, object[] obj)
		{
			if(obj.Length == 1)
				c.Scale((SizeF)obj[0]);
		}
        /// <include file='doc\Control.uex' path='docs/doc[@for="ContainerControl.OnChildLayoutResuming"]/*' />
        /// <devdoc>
        ///     Called when a child is about to resume its layout.  The default implementation
        ///     calls OnChildLayoutResuming on the parent.
        /// </devdoc>
        internal override void OnChildLayoutResuming(Control child, bool performLayout) {
            base.OnChildLayoutResuming(child, performLayout);

            // We need to scale children before their layout engines get to them.
            // We don't have a lot of opportunity for that because the code
            // generator always generates a PerformLayout() right after a
            // ResumeLayout(false).  This seems to be the most oppportune place
            // for thiis, although it is unfortunate.
            if (!state[stateScalingChild] && !performLayout && AutoScaleMode != AutoScaleMode.None && AutoScaleMode != AutoScaleMode.Inherit && state[stateScalingNeededOnLayout]) {
                state[stateScalingChild] = true;
                try {
                    child.Scale(AutoScaleFactor, SizeF.Empty, this);
                }
                finally {
                    state[stateScalingChild] = false;
                }
            }
        }
Ejemplo n.º 6
0
		public void TestPublicMethods ()
		{
			// Public Methods that force Handle creation:
			// - CreateControl ()
			// - CreateGraphics ()
			// - GetChildAtPoint ()
			// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
			// - PointToClient ()
			// - PointToScreen ()
			// - RectangleToClient ()
			// - RectangleToScreen ()
			Control c = new Control ();
			
			c.BringToFront ();
			Assert.IsFalse (c.IsHandleCreated, "A1");
			c.Contains (new Control ());
			Assert.IsFalse (c.IsHandleCreated, "A2");
			c.CreateControl ();
			Assert.IsTrue (c.IsHandleCreated, "A3");
			c = new Control ();
			Graphics g = c.CreateGraphics ();
			g.Dispose ();
			Assert.IsTrue (c.IsHandleCreated, "A4");
			c = new Control ();
			c.Dispose ();
			Assert.IsFalse (c.IsHandleCreated, "A5");
			c = new Control ();
			//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
			//Assert.IsFalse (c.IsHandleCreated, "A6");
			//Assert.AreEqual (DragDropEffects.None, d, "A6b");
			//Bitmap b = new Bitmap (100, 100);
			//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
			//Assert.IsFalse (c.IsHandleCreated, "A7");
			//b.Dispose ();
			c.FindForm ();
			Assert.IsFalse (c.IsHandleCreated, "A8");
			c.Focus ();
			Assert.IsFalse (c.IsHandleCreated, "A9");

			c.GetChildAtPoint (new Point (10, 10));
			Assert.IsTrue (c.IsHandleCreated, "A10");
			c.GetContainerControl ();
			c = new Control ();
			Assert.IsFalse (c.IsHandleCreated, "A11");
			c.GetNextControl (new Control (), true);
			Assert.IsFalse (c.IsHandleCreated, "A12");
#if NET_2_0
			c.GetPreferredSize (Size.Empty);
			Assert.IsFalse (c.IsHandleCreated, "A13");
#endif
			c.Hide ();
			Assert.IsFalse (c.IsHandleCreated, "A14");
			c.Invalidate ();
			Assert.IsFalse (c.IsHandleCreated, "A15");
			//c.Invoke (new InvokeDelegate (InvokeMethod));
			//Assert.IsFalse (c.IsHandleCreated, "A16");
			c.PerformLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A17");
			c.PointToClient (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A18");
			c = new Control ();
			c.PointToScreen (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A19");
			c = new Control ();
			//c.PreProcessControlMessage   ???
			//c.PreProcessMessage          ???
			c.RectangleToClient (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A20");
			c = new Control ();
			c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A21");
			c = new Control ();
			c.Refresh ();
			Assert.IsFalse (c.IsHandleCreated, "A22");
			c.ResetBackColor ();
			Assert.IsFalse (c.IsHandleCreated, "A23");
			c.ResetBindings ();
			Assert.IsFalse (c.IsHandleCreated, "A24");
			c.ResetCursor ();
			Assert.IsFalse (c.IsHandleCreated, "A25");
			c.ResetFont ();
			Assert.IsFalse (c.IsHandleCreated, "A26");
			c.ResetForeColor ();
			Assert.IsFalse (c.IsHandleCreated, "A27");
			c.ResetImeMode ();
			Assert.IsFalse (c.IsHandleCreated, "A28");
			c.ResetRightToLeft ();
			Assert.IsFalse (c.IsHandleCreated, "A29");
			c.ResetText ();
			Assert.IsFalse (c.IsHandleCreated, "A30");
			c.SuspendLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A31");
			c.ResumeLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A32");
#if NET_2_0
			c.Scale (new SizeF (1.5f, 1.5f));
			Assert.IsFalse (c.IsHandleCreated, "A33");
#endif
			c.Select ();
			Assert.IsFalse (c.IsHandleCreated, "A34");
			c.SelectNextControl (new Control (), true, true, true, true);
			Assert.IsFalse (c.IsHandleCreated, "A35");
			c.SetBounds (0, 0, 100, 100);
			Assert.IsFalse (c.IsHandleCreated, "A36");
			c.Update ();
			Assert.IsFalse (c.IsHandleCreated, "A37");
		}
Ejemplo n.º 7
0
		public void ScaleTest()
		{
			Control r1 = new Control();

			r1.Width = 40;
			r1.Height = 20;
			r1.Scale(2);
			Assert.AreEqual(80, r1.Width, "Scale1");
			Assert.AreEqual(40, r1.Height, "Scale2");
		}
Ejemplo n.º 8
0
 /// <summary>
 /// Scales a control from 96dpi to the actual screen dpi.
 /// </summary>
 public static void Scale(Control c)
 {
     c.Scale(new SizeF((float)PixelsPerLogicalInchX / DEFAULT_DPI, (float)PixelsPerLogicalInchY / DEFAULT_DPI));
 }
Ejemplo n.º 9
0
		public static void CallControlScale(Control c, object[] obj)
		{
			if(obj.Length == 1)
				c.Scale((float)obj[0]);
			else if(obj.Length == 2)
				c.Scale((float)obj[0], (float)obj[1]);
		}
Ejemplo n.º 10
0
 public static sys.Control CustomScale(this sys.Control control, float scalingFactor)
 {
     control.Scale(new SizeF(scalingFactor, scalingFactor));
     return(control);
 }
 internal override void OnChildLayoutResuming(Control child, bool performLayout)
 {
     base.OnChildLayoutResuming(child, performLayout);
     if (((!this.state[stateScalingChild] && !performLayout) && ((this.AutoScaleMode != System.Windows.Forms.AutoScaleMode.None) && (this.AutoScaleMode != System.Windows.Forms.AutoScaleMode.Inherit))) && this.state[stateScalingNeededOnLayout])
     {
         this.state[stateScalingChild] = true;
         try
         {
             child.Scale(this.AutoScaleFactor, SizeF.Empty, this);
         }
         finally
         {
             this.state[stateScalingChild] = false;
         }
     }
 }