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


C# Size类代码示例

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


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


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