当前位置: 首页>>代码示例>>C#>>正文


C# SizeF类代码示例

本文整理汇总了C#中SizeF的典型用法代码示例。如果您正苦于以下问题:C# SizeF类的具体用法?C# SizeF怎么用?C# SizeF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SizeF类属于命名空间,在下文中一共展示了SizeF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainForm

	public MainForm ()
	{
		// 
		// _tableLayoutPanel
		// 
		_tableLayoutPanel = new TableLayoutPanel ();
		_tableLayoutPanel.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
		_tableLayoutPanel.ColumnCount = 3;
		_tableLayoutPanel.ColumnStyles.Add (new ColumnStyle ());
		_tableLayoutPanel.ColumnStyles.Add (new ColumnStyle ());
		_tableLayoutPanel.ColumnStyles.Add (new ColumnStyle ());
		_tableLayoutPanel.Dock = DockStyle.Fill;
		_tableLayoutPanel.RowCount = 2;
		_tableLayoutPanel.RowStyles.Add (new RowStyle (SizeType.Percent, 50F));
		_tableLayoutPanel.RowStyles.Add (new RowStyle (SizeType.Percent, 50F));
		Controls.Add (_tableLayoutPanel);
		// 
		// _buttonA
		// 
		_buttonA = new Button ();
		_buttonA.TabIndex = 1;
		_buttonA.Text = "Button A";
		_buttonA.UseVisualStyleBackColor = true;
		_tableLayoutPanel.Controls.Add (_buttonA, 0, 1);
		// 
		// _buttonB
		// 
		_buttonB = new Button ();
		_buttonB.TabIndex = 4;
		_buttonB.Text = "Button B";
		_buttonB.UseVisualStyleBackColor = true;
		_tableLayoutPanel.Controls.Add (_buttonB, 2, 1);
		// 
		// _label
		// 
		_label = new Label ();
		_label.AutoSize = true;
		_label.Dock = DockStyle.Fill;
		_label.TabIndex = 6;
		_label.Text = "Label";
		_tableLayoutPanel.Controls.Add (_label, 1, 1);
		// 
		// _textBox
		// 
		_textBox = new TextBox ();
		_textBox.Dock = DockStyle.Fill;
		_textBox.Multiline = true;
		_textBox.TabIndex = 7;
		_tableLayoutPanel.Controls.Add (_textBox, 1, 0);
		// 
		// MainForm
		// 
		AutoScaleDimensions = new SizeF (6F, 13F);
		AutoScaleMode = AutoScaleMode.Font;
		ClientSize = new Size (292, 300);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81843";
		Load += new EventHandler (MainForm_Load);
	}
开发者ID:mono,项目名称:gert,代码行数:60,代码来源:MainForm.cs

示例2: RectangleF

 /// <summary>Initializes a new instance of the <see cref="T:System.Drawing.RectangleF"></see> class with the specified location and size.</summary>
 /// <param name="size">A <see cref="T:System.Drawing.SizeF"></see> that represents the width and height of the rectangular region. </param>
 /// <param name="location">A <see cref="T:System.Drawing.PointF"></see> that represents the upper-left corner of the rectangular region. </param>
 public RectangleF(Vector2 location, SizeF size)
 {
     this.x = location.X;
     this.y = location.Y;
     this.width = size.Width;
     this.height = size.Height;
 }
开发者ID:Gayo,项目名称:Gayo-CAROT,代码行数:10,代码来源:RectangleF.cs

示例3: SizeToSizeF

 public void SizeToSizeF()
 {
     var size = new Size(10, 15);
     var actual = size.ToSizeF();
     var expected = new SizeF(10, 15);
     Assert.AreEqual(expected, actual);
 }
开发者ID:Mirandatz,项目名称:Trauer,代码行数:7,代码来源:SizeTests.cs

示例4: RectangleF

	// Constructors.
	public RectangleF(PointF location, SizeF size)
			{
				x = location.X;
				y = location.Y;
				width = size.Width;
				height = size.Height;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:RectangleF.cs

示例5: Clamp

 /// <summary>
 /// Clamps point coordinate according to the specified size (0,0, size.Width, size.Height).
 /// </summary>
 /// <param name="point">The point to clamp.</param>
 /// <param name="size">The valid region.</param>
 /// <returns>Clamped point.</returns>
 public static PointF Clamp(this PointF point, SizeF size)
 {
     return new PointF
     {
         X = System.Math.Min(System.Math.Max(0, point.X), size.Width),
         Y = System.Math.Min(System.Math.Max(0, point.Y), size.Height)
     };
 }
开发者ID:remingtonsteel,项目名称:accord-net-extensions,代码行数:14,代码来源:PointExtensions.cs

示例6: BuildLookupList

 private static void BuildLookupList(IDeviceContext g, Font font, ref SizeF[] size)
 {
     size = new SizeF[char.MaxValue];
     for (var i = (char)0; i < (char)256; i++)
     {
         size[i] = MeasureString(g, font, i.ToString());
     }
 }
开发者ID:duyisu,项目名称:MissionPlanner,代码行数:8,代码来源:MeasureString.cs

示例7: NonDefaultConstructorTest

        public void NonDefaultConstructorTest(float x, float y, float width, float height)
        {
            RectangleF rect1 = new RectangleF(x, y, width, height);
            PointF p = new PointF(x, y);
            SizeF s = new SizeF(width, height);
            RectangleF rect2 = new RectangleF(p, s);

            Assert.Equal(rect1, rect2);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:9,代码来源:RectangleFTests.cs

示例8: MeasureString

 private static SizeF MeasureString(IDeviceContext g, IList text, Font font, FontData data)
 {
     SizeF ans = new SizeF();
         foreach (char chr in text)
         {
             SizeF temp = MeasureString(g, chr, font, data);
             ans = new SizeF(ans.Width + temp.Width, temp.Height);
         }
         return ans;
 }
开发者ID:LeoTosti,项目名称:x-drone,代码行数:10,代码来源:MeasureString.cs

示例9: ResizeFactorConstructorFromSizeFToSizeNotPreservingProportions

        public void ResizeFactorConstructorFromSizeFToSizeNotPreservingProportions()
        {
            var from = new SizeF(123, 456);
            var to = new SizeF(456, 789);
            var factor = new ResizeFactor(from, to, false);
            var expectedHorizontalFactor = to.Width / from.Width;
            var expectedVerticalFactor = to.Height / from.Height;

            Assert.AreEqual(expectedHorizontalFactor, factor.Horizontal);
            Assert.AreEqual(expectedVerticalFactor, factor.Vertical);
        }
开发者ID:Mirandatz,项目名称:Trauer,代码行数:11,代码来源:ResizeFactorTests.cs

示例10: ArithmeticTestWithSizeF

        public void ArithmeticTestWithSizeF(float x, float y)
        {
            PointF p = new PointF(x, y);
            SizeF s = new SizeF(y, x);

            PointF addExpected = new PointF(x + y, y + x);
            PointF subExpected = new PointF(x - y, y - x);
            Assert.Equal(addExpected, p + s);
            Assert.Equal(subExpected, p - s);
            Assert.Equal(addExpected, PointF.Add(p, s));
            Assert.Equal(subExpected, PointF.Subtract(p, s));
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:12,代码来源:PointFTests.cs

示例11: ArithmeticTest

        public void ArithmeticTest(float width, float height)
        {
            SizeF s1 = new SizeF(width, height);
            SizeF s2 = new SizeF(height, width);
            SizeF addExpected = new SizeF(width + height, width + height);
            SizeF subExpected = new SizeF(width - height, height - width);

            Assert.Equal(addExpected, s1 + s2);
            Assert.Equal(addExpected, SizeF.Add(s1, s2));

            Assert.Equal(subExpected, s1 - s2);
            Assert.Equal(subExpected, SizeF.Subtract(s1, s2));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:13,代码来源:SizeFTests.cs

示例12: NonDefaultConstructorAndDimensionsTest

        public void NonDefaultConstructorAndDimensionsTest(float width, float height)
        {
            SizeF s1 = new SizeF(width, height);
            PointF p1 = new PointF(width, height);
            SizeF s2 = new SizeF(s1);

            Assert.Equal(s1, s2);
            Assert.Equal(s1, new SizeF(p1));
            Assert.Equal(s2, new SizeF(p1));

            Assert.Equal(width, s1.Width);
            Assert.Equal(height, s1.Height);
        }
开发者ID:jemmy655,项目名称:corefx,代码行数:13,代码来源:SizeFTests.cs

示例13: DimensionsTest

        public void DimensionsTest(float x, float y, float width, float height)
        {
            RectangleF rect = new RectangleF(x, y, width, height);
            PointF p = new PointF(x, y);
            SizeF s = new SizeF(width, height);

            Assert.Equal(p, rect.Location);
            Assert.Equal(s, rect.Size);
            Assert.Equal(x, rect.X);
            Assert.Equal(y, rect.Y);
            Assert.Equal(width, rect.Width);
            Assert.Equal(height, rect.Height);
            Assert.Equal(x, rect.Left);
            Assert.Equal(y, rect.Top);
            Assert.Equal(x + width, rect.Right);
            Assert.Equal(y + height, rect.Bottom);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:17,代码来源:RectangleFTests.cs

示例14: EqualityTest

        public void EqualityTest(float width, float height)
        {
            SizeF sLeft = new SizeF(width, height);
            SizeF sRight = new SizeF(height, width);

            if (width == height)
            {
                Assert.True(sLeft == sRight);
                Assert.False(sLeft != sRight);
                Assert.True(sLeft.Equals(sRight));
                Assert.Equal(sLeft.GetHashCode(), sRight.GetHashCode());
                return;
            }

            Assert.True(sLeft != sRight);
            Assert.False(sLeft == sRight);
            Assert.False(sLeft.Equals(sRight));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:18,代码来源:SizeFTests.cs

示例15: InitCallAndSendMsgBtns

            private void InitCallAndSendMsgBtns()
            {
                var image = UIImage.FromFile ("Images/Info/button.png");

                _buttonSize = new SizeF (120, image.Size.Height);
                _btnCall = new UIButton (UIButtonType.RoundedRect);
                _btnCall.SetImage (new UIImage ("Images/Info/icon_phone.png"), UIControlState.Normal);
                _btnCall.SetStretchableImage ("Images/Info/button.png", "Images/Info/button_pressed.png");
                _btnCall.ImageEdgeInsets = new UIEdgeInsets (0, 0, 10, 0);

                _btnSendMessage = new UIButton (UIButtonType.RoundedRect);
                _btnSendMessage.SetImage (new UIImage ("Images/Info/icon_mail.png"), UIControlState.Normal);
                _btnSendMessage.SetStretchableImage ("Images/Info/button.png", "Images/Info/button_pressed.png");
                _btnSendMessage.ImageEdgeInsets = new UIEdgeInsets (0, 0, 10, 0);

                AddSubview (_btnCall);
                AddSubview (_btnSendMessage);
            }
开发者ID:RomanYemelyanenko,项目名称:hashbot,代码行数:18,代码来源:InfoSrolableResizebleView.cs


注:本文中的SizeF类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。