• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Size类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InstructionsForm

	public InstructionsForm ()
	{
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Fill;
		Controls.Add (_tabControl);
		// 
		// _bugDescriptionText1
		// 
		_bugDescriptionText1 = new TextBox ();
		_bugDescriptionText1.Multiline = true;
		_bugDescriptionText1.Location = new Point (8, 8);
		_bugDescriptionText1.Dock = DockStyle.Fill;
		_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
			"Expected result on start-up:{0}{0}" +
			"1. The background color of the Form is blue and does not show " +
			"any distortions.",
			Environment.NewLine);
		// 
		// _tabPage1
		// 
		_tabPage1 = new TabPage ();
		_tabPage1.Text = "#1";
		_tabPage1.Controls.Add (_bugDescriptionText1);
		_tabControl.Controls.Add (_tabPage1);
		// 
		// InstructionsForm
		// 
		ClientSize = new Size (330, 120);
		Location = new Point (600, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "Instructions - bug #81721";
	}
开发者ID:mono,项目名称:gert,代码行数:35,代码来源:MainForm.cs


示例2: mouseListner_MouseDown

    void mouseListner_MouseDown(object sender, MouseEventArgs e)
    {
        lastMouseDownPoint = e.Location;
        lastMouseDownSize = sizeChangeCtrl.Size;

        //動作を決定
        status = DAndDArea.None;
        if (getTop().Contains(e.Location))
        {
            status |= DAndDArea.Top;
        }
        if (getLeft().Contains(e.Location))
        {
            status |= DAndDArea.Left;
        }
        if (getBottom().Contains(e.Location))
        {
            status |= DAndDArea.Bottom;
        }
        if (getRight().Contains(e.Location))
        {
            status |= DAndDArea.Right;
        }

        if (status != DAndDArea.None)
        {
            mouseListner.Capture = true;
        }
    }
开发者ID:masahoshiro,项目名称:FinalFantasyXIV_ARR_Tools,代码行数:29,代码来源:DAndDSizeChanger.cs


示例3: DrawGraphic

        public void DrawGraphic(ref Hashtable graphicLibrary, int frameNumber, Point3D location, Size objSize, ref Bitmap image)
        {
            if (location.X >= 0 || location.Y >= 0 ||
                location.X + ((Bitmap)graphicLibrary[BaseImage]).Width >= 0 ||
                location.Y + ((Bitmap)graphicLibrary[BaseImage]).Height >= 0 &&
                location.X > NumberOfFrames)
                frameNumber -= NumberOfFrames;

            var gfx = Graphics.FromImage(image);

            var grab = FrameInitialOffset;
            if (Vertical)
            {
                grab.Y = FrameInitialOffset.Y + FrameSize.Height * (frameNumber - 1);
            }
            else
            {
                grab.X = FrameInitialOffset.X + FrameSize.Width * (frameNumber - 1);
            }

            var destRec = new Rectangle(location.X, location.Y, objSize.Width, objSize.Height);
            var srcRec = new Rectangle(grab, FrameSize);

            gfx.DrawImage(graphicLibrary[BaseImage] as Bitmap, destRec, srcRec, GraphicsUnit.Pixel);
        }
开发者ID:anlugifa,项目名称:GameEngine,代码行数:25,代码来源:GraphicObject.cs


示例4: MainForm

	public MainForm ()
	{
		_checkedListBox = new CheckedListBox ();
		_checkedListBox.Dock = DockStyle.Top;
		_checkedListBox.Font = new Font (_checkedListBox.Font.FontFamily, _checkedListBox.Font.Height + 8);
		_checkedListBox.Height = 120;
		Controls.Add (_checkedListBox);
		// 
		// _threeDCheckBox
		// 
		_threeDCheckBox = new CheckBox ();
		_threeDCheckBox.Checked = _checkedListBox.ThreeDCheckBoxes;
		_threeDCheckBox.FlatStyle = FlatStyle.Flat;
		_threeDCheckBox.Location = new Point (8, 125);
		_threeDCheckBox.Text = "3D checkboxes";
		_threeDCheckBox.CheckedChanged += new EventHandler (ThreeDCheckBox_CheckedChanged);
		Controls.Add (_threeDCheckBox);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 150);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82100";
		Load += new EventHandler (MainForm_Load);
	}
开发者ID:mono,项目名称:gert,代码行数:26,代码来源:MainForm.cs


示例5: Main

 public static void Main()
 {
     Bitmap bitmap = (Bitmap)Image.FromFile("images.bmp");
     string path = "InterpolateImage.bmp";
     Size size = new Size(1920, 1080);
     ResampleImage(bitmap, size, path);
 }
开发者ID:iMitaka,项目名称:HackBulgaria,代码行数:7,代码来源:InterpolateImage.cs


示例6: MainForm

	public MainForm ()
	{
		_dataGrid = new DataGridView ();
		_column = new DataGridViewTextBoxColumn ();
		SuspendLayout ();
		((ISupportInitialize) (_dataGrid)).BeginInit ();
		// 
		// _dataGrid
		// 
		_dataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		_dataGrid.Columns.Add (_column);
		_dataGrid.RowTemplate.Height = 21;
		_dataGrid.Location = new Point (12, 115);
		_dataGrid.Size = new Size (268, 146);
		_dataGrid.TabIndex = 0;
		// 
		// _column
		// 
		_column.HeaderText = "Column";
		// 
		// MainForm
		// 
		ClientSize = new Size (292, 273);
		Controls.Add (_dataGrid);
		((ISupportInitialize) (_dataGrid)).EndInit ();
		ResumeLayout (false);
		Load += new EventHandler (MainForm_Load);
	}
开发者ID:mono,项目名称:gert,代码行数:28,代码来源:MainForm.cs


示例7: RepaintGDI

        public override Bitmap RepaintGDI(out Size gdiSize)
        {
            // figure out the size of the label
            gdiSize = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(_label, font).ToSize();

            // adjust labelSize to power of 2
            Size textureSize = makeValidTextureSize((int)gdiSize.Width, (int)gdiSize.Height);

            // draw the string onto a bitmap
            var bitmap = new Bitmap(textureSize.Width, textureSize.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            var gc = Graphics.FromImage(bitmap);
            // gc.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            gc.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            gc.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
            // gc.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
            gc.Clear(Color.Black);
            // gc.DrawLine(Pens.White,4,4,textureSize.Width-1,4);
            // gc.DrawRectangle(Pens.White,0,0,textureSize.Width-1,textureSize.Height-1);

            gc.DrawString(_label, font, Brushes.White, 0, 0);
            gc.Flush();

            // Console.WriteLine("SSObjectGDIText: created texture size = {0} {1}", bitmap.Width, bitmap.Height);
            // DUMP_TEX_PIXELS(bitmap);

            return bitmap;
        }
开发者ID:EMAGStefanMueller,项目名称:SimpleScene,代码行数:27,代码来源:SSObjectGDISurface_Text.cs


示例8: GameArea

 public GameArea(int screenWidth, int screenHeight, int decreaseX, int decreaseY)
 {
     _screenWidth = screenWidth;
     _screenHeight = screenHeight;
     _background = new Bitmap(System.IO.Path.Combine("Images", "GameArea.png"));
     GameAreaSize = new Size(_background.Width - decreaseX, _background.Height - decreaseY);
 }
开发者ID:shusso,项目名称:Strategy-Game,代码行数:7,代码来源:GameArea.cs


示例9: Plane

 public Plane(int startFrame, Vector2 position, float rotation, Size windowSize)
 {
     this.StartFrame = startFrame;
     this.Position = position;
     this.Rotation = rotation;
     this.windowSize = windowSize;
 }
开发者ID:smack0007,项目名称:Samurai,代码行数:7,代码来源:Plane.cs


示例10: SelectItem

    public SelectItem( )
    {
        // Set captions
        Text = "Select Item";
        square.Text = "Square";
        circle.Text = "Circle";
        color.Text = "Choose a color";

          // Set size
        Size = new Size(400,250);

          // Set locations
        int w = 20;
        square.Location = new Point(w, 30);
        circle.Location = new Point(w += 10 + square.Width, 30);
        color.Location = new Point(w += 10 + circle.Width, 30);

          // Add color names to combo box
        color.Items.Add("Red");
        color.Items.Add("Green");
        color.Items.Add("Blue");

          // Add controls to form
        Controls.Add(square);
        Controls.Add(circle);
        Controls.Add(color);

          // Register event handlers
        square.CheckedChanged += new EventHandler(Checked_Changed);
        circle.CheckedChanged += new EventHandler(Checked_Changed);
        color.SelectedIndexChanged +=
                          new EventHandler(Selected_Index);
    }
开发者ID:JnS-Software-LLC,项目名称:CSC153,代码行数:33,代码来源:SelectItem+(1).cs


示例11: UpdateClipSize

        public static void UpdateClipSize(FrameworkElement element, Size clipSize)
        {
            if (element != null)
            {
                RectangleGeometry clipRectangle = null;

                if (element.Clip == null)
                {
                    clipRectangle = new RectangleGeometry();
                    element.Clip = clipRectangle;
                }
                else
                {
                    if (element.Clip is RectangleGeometry)
                    {
                        clipRectangle = (RectangleGeometry)element.Clip;
                    }
                }

                if (clipRectangle != null)
                {
                    clipRectangle.Rect = new Rect(new Point(0, 0), clipSize);
                }
            }
        }
开发者ID:namlunoy,项目名称:benhvathuoc,代码行数:25,代码来源:ClipToBounds.cs


示例12: ShippingDimensionsYMustBeNonZero

 public void ShippingDimensionsYMustBeNonZero()
 {
     var zeroSizeY = new Size<float> { X = 1f, Y = 0f };
     strategy.Invoking(s => s.CalculateShippingCost(1, zeroSizeY, RegionInfo.CurrentRegion))
         .ShouldThrow<ArgumentOutOfRangeException>("Package dimension must be positive and non-zero")
         .And.ParamName.Should().Be("packageDimensionsInInches");
 }
开发者ID:aleksandrzak-rafal,项目名称:AdaptiveCode,代码行数:7,代码来源:WorldWideShippingStrategyTests.cs


示例13: SetElementSize

		public void SetElementSize(Size size)
		{
			if (_loaded)
				Element.Layout(new Rectangle(Element.X, Element.Y, size.Width, size.Height));
			else
				_queuedSize = size;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:TabbedRenderer.cs


示例14: IniciarComponentes

    public void IniciarComponentes()
    {
        lblSaludo = new Label();
        btSaludo = new Button();
        ttToolTip1 = new ToolTip();

        lblSaludo.Name = "lblSaludo";
        lblSaludo.Text = "Label";
        lblSaludo.Font = new Font("Microsoft Sans Serif", 14, FontStyle.Regular);
        lblSaludo.TextAlign = ContentAlignment.MiddleCenter;
        lblSaludo.Location = new Point(53, 48);
        lblSaludo.Size = new Size(187, 35);
        lblSaludo.TabIndex = 1;

        btSaludo.Name = "btSaludo";
        btSaludo.Text = "Haga &clic aquí";
        btSaludo.Location = new Point(53, 90);
        btSaludo.Size = new Size(187, 23);
        btSaludo.TabIndex = 0;
        ttToolTip1.SetToolTip(btSaludo, "Botón de pulsación");

        ClientSize = new Size(292, 191);
        Name = "Form1";
        Text = "Saludo";

        Controls.Add(lblSaludo);
        Controls.Add(btSaludo);
    }
开发者ID:ThirteenWolf,项目名称:Ejercicios,代码行数:28,代码来源:Ejercicio1.cs


示例15: ExplicitCastFromPoint

 public void ExplicitCastFromPoint()
 {
     var p = new Point(1, 2);
     var s = new Size(1, 2);
     Size addition = (Size)p + s;
     Assert.AreEqual(new Size(2, 4), addition);
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:7,代码来源:SizeTests.cs


示例16: ColorExample

 public ColorExample()
 {
     Text = "Colors";
     Size = new Size(360, 120);
     Paint += new PaintEventHandler(OnPaint);
     CenterToScreen();
 }
开发者ID:JohanMoreau,项目名称:dev-koans,代码行数:7,代码来源:Color.cs


示例17: HelloWindow

    public HelloWindow () {
      border = 2;

      label1 = new Label();
      label1.Text = catalog.GetString("Hello, world!");
      label1.ClientSize = new Size(label1.PreferredWidth, label1.PreferredHeight);
      Controls.Add(label1);

      label2 = new Label();
      label2.Text =
        String.Format(
            catalog.GetString("This program is running as process number {0}."),
            Process.GetCurrentProcess().Id);
      label2.ClientSize = new Size(label2.PreferredWidth, label2.PreferredHeight);
      Controls.Add(label2);

      ok = new Button();
      Label okLabel = new Label();
      ok.Text = okLabel.Text = "OK";
      ok.ClientSize = new Size(okLabel.PreferredWidth + 12, okLabel.PreferredHeight + 4);
      ok.Click += new EventHandler(Quit);
      Controls.Add(ok);

      Size total = ComputePreferredSizeWithoutBorder();
      LayoutControls(total.Width, total.Height);
      ClientSize = new Size(border + total.Width + border, border + total.Height + border);
    }
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:27,代码来源:hello.cs


示例18: Redimensionar

        public static void Redimensionar(String caminhoOriginal, Size tamanho, EnumFormato formato, bool manterProporcao)
        {
            Bitmap original = (Bitmap)System.Drawing.Image.FromFile(caminhoOriginal);
            string caminhoFinal = caminhoOriginal;

            Redimensionar(original, caminhoFinal, tamanho, formato, manterProporcao);
        }
开发者ID:salez,项目名称:Guirotab,代码行数:7,代码来源:Imagem.cs


示例19: Icon

		public async Task Icon ()
		{
			var size = new Size (64);
			var canvas = Platforms.Current.CreateImageCanvas (size, scale: 2);
			canvas.SaveState ();
			canvas.Scale (size);
			canvas.Translate (1 / 8.0, 0);

			var p = new Path ();
			p.MoveTo (0, 1);
			p.LineTo (0, 0);
			p.LineTo (0.5, 1);
			p.LineTo (0.5, 0);

			var colors = new [] {
				"#DCDCDD",
				"#C5C3C6",
				"#46494C",
				"#4C5C68",
				"#68A5E2",
			};
			foreach (var c in colors) {
				p.Pen = new Pen (c, 1 / 4.0);
				p.Draw (canvas);
				canvas.Translate (1 / 16.0, 0);
			}

			await SaveImage (canvas, "Icon.png");
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:29,代码来源:ReadmeTests.cs


示例20: MeasureOverride

        protected override Size MeasureOverride(Size availableSize)
        {
            double width = 0;
            double height = 0;
            Vector scale = new Vector();

            if (this.Source != null)
            {
                width = this.Source.PixelWidth;
                height = this.Source.PixelHeight;

                if (this.Width > 0)
                {
                    availableSize = new Size(this.Width, availableSize.Height);
                }

                if (this.Height > 0)
                {
                    availableSize = new Size(availableSize.Width, this.Height);
                }

                scale = CalculateScaling(availableSize, new Size(width, height), this.Stretch);
            }

            return new Size(width * scale.X, height * scale.Y);
        }
开发者ID:MarkWalls,项目名称:Perspex,代码行数:26,代码来源:Image.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Size2类代码示例发布时间:2022-05-24
下一篇:
C# Situation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap