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;
        }
    }
Example #2
1
	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";
	}
Example #3
0
 public GraphicObject(string baseImg, Size frameSize, Point frameInitialOffset, int fps, bool vertical)
 {
     this.BaseImage = baseImg;
     this.FrameSize = FrameSize;
     this.FrameInitialOffset = frameInitialOffset;
     this.Vertical = vertical;
 }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
	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);
	}
Example #7
0
        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);
        }
Example #8
0
 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);
 }
Example #9
0
	public MainForm ()
	{
		// 
		// _richTextBox
		// 
		_richTextBox = new RichTextBox ();
		_richTextBox.Dock = DockStyle.Top;
		_richTextBox.Height = 160;
		Controls.Add (_richTextBox);
		// 
		// _wordWrapCheckBox
		// 
		_wordWrapCheckBox = new CheckBox ();
		_wordWrapCheckBox.Checked = _richTextBox.WordWrap;
		_wordWrapCheckBox.Location = new Point (8, 170);
		_wordWrapCheckBox.Text = "WordWrap";
		_wordWrapCheckBox.CheckedChanged += new EventHandler (WordWrapCheckBox_CheckedChanged);
		Controls.Add (_wordWrapCheckBox);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 200);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81488";
		Load += new EventHandler (MainForm_Load);
	}
Example #10
0
	public InstructionsForm ()
	{
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Fill;
		Controls.Add (_tabControl);
		// 
		// _bugDescriptionText1
		// 
		_bugDescriptionText1 = new TextBox ();
		_bugDescriptionText1.Multiline = true;
		_bugDescriptionText1.Dock = DockStyle.Fill;
		_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
			"Expected result on start-up:{0}{0}" +
			"1. The text \"2\" is displayed.",
			Environment.NewLine);
		// 
		// _tabPage1
		// 
		_tabPage1 = new TabPage ();
		_tabPage1.Text = "#1";
		_tabPage1.Controls.Add (_bugDescriptionText1);
		_tabControl.Controls.Add (_tabPage1);
		// 
		// InstructionsForm
		// 
		ClientSize = new Size (400, 90);
		Location = new Point (550, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "Instructions - bug #80792";
	}
Example #11
0
 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);
 }
Example #12
0
	public MainForm ()
	{
		// 
		// _label2
		// 
		_label2 = new Label ();
		_label2.Text = "2";
		_label2.Dock = DockStyle.Bottom;
		Controls.Add (_label2);
		// 
		// _label1
		// 
		_label1 = new Label ();
		_label1.Text = "1";
		_label1.Dock = DockStyle.Top;
		Controls.Add (_label1);
		// 
		// MainForm
		// 
		ClientSize = new Size (ClientSize.Width, _label1.Height);
		Location = new Point (200, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #80792";
		Load += new EventHandler (MainForm_Load);
	}
 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");
 }
Example #14
0
	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);
	}
Example #15
0
	public MainForm ()
	{
		// 
		// _propertyGrid
		// 
		_propertyGrid = new PropertyGrid ();
		_propertyGrid.Dock = DockStyle.Top;
		_propertyGrid.Height = 200;
		Controls.Add (_propertyGrid);
		// 
		// _resetButton
		// 
		_resetButton = new Button ();
		_resetButton.Location = new Point (120, 210);
		_resetButton.Size = new Size (60, 20);
		_resetButton.Text = "Reset";
		_resetButton.Click += new EventHandler (ResetButton_Click);
		Controls.Add (_resetButton);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 240);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #339001";
		Load += new EventHandler (MainForm_Load);
	}
Example #16
0
        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);
                }
            }
        }
Example #17
0
		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");
		}
Example #18
0
        public void EqualsOperator_WhenHeightIsTheSameAsWidth_ReturnsTrue()
        {
            var sizeA = new Size(1, 1);
            var sizeB = new Size(1, 1);

            Assert.IsTrue(sizeA == sizeB);
        }
Example #19
0
 public ColorExample()
 {
     Text = "Colors";
     Size = new Size(360, 120);
     Paint += new PaintEventHandler(OnPaint);
     CenterToScreen();
 }
Example #20
0
    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);
    }
Example #21
0
		public void SetElementSize(Size size)
		{
			if (_loaded)
				Element.Layout(new Rectangle(Element.X, Element.Y, size.Width, size.Height));
			else
				_queuedSize = size;
		}
Example #22
0
    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);
    }
        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;
        }
Example #24
0
 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);
 }
Example #25
0
	public InstructionsForm ()
	{
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Fill;
		Controls.Add (_tabControl);
		// 
		// _bugDescriptionText1
		// 
		_bugDescriptionText1 = new TextBox ();
		_bugDescriptionText1.Dock = DockStyle.Fill;
		_bugDescriptionText1.Multiline = true;
		_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
			"Steps to execute:{0}{0}" +
			"1. Press the Alt+F4 key.{0}{0}" +
			"Expected result:{0}{0}" +
			"1. The application exits.",
			Environment.NewLine);
		// 
		// _tabPage1
		// 
		_tabPage1 = new TabPage ();
		_tabPage1.Text = "#1";
		_tabPage1.Controls.Add (_bugDescriptionText1);
		_tabControl.Controls.Add (_tabPage1);
		// 
		// InstructionsForm
		// 
		ClientSize = new Size (300, 140);
		Location = new Point (600, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "Instructions - bug #358340";
	}
Example #26
0
 public Plane(int startFrame, Vector2 position, float rotation, Size windowSize)
 {
     this.StartFrame = startFrame;
     this.Position = position;
     this.Rotation = rotation;
     this.windowSize = windowSize;
 }
Example #27
0
	public InstructionsForm ()
	{
		// 
		// _tabControl
		// 
		_tabControl = new TabControl ();
		_tabControl.Dock = DockStyle.Fill;
		Controls.Add (_tabControl);
		// 
		// _bugDescriptionText1
		// 
		_bugDescriptionText1 = new TextBox ();
		_bugDescriptionText1.Dock = DockStyle.Fill;
		_bugDescriptionText1.Multiline = true;
		_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
			"Steps to execute:{0}{0}" +
			"1. Type \"12345\" and the hit the Enter key.{0}{0}" +
			"Expected result:{0}{0}" +
			"1. The character \"3\" and the Enter key are ignored.",
			Environment.NewLine);
		// 
		// _tabPage1
		// 
		_tabPage1 = new TabPage ();
		_tabPage1.Text = "#1";
		_tabPage1.Controls.Add (_bugDescriptionText1);
		_tabControl.Controls.Add (_tabPage1);
		// 
		// InstructionsForm
		// 
		ClientSize = new Size (300, 155);
		Location = new Point (600, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "Instructions - bug #340078";
	}
Example #28
0
    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);
    }
Example #29
0
	public MainForm ()
	{
		_resizeControl = new ResizeControl ();
		// 
		// _panel
		// 
		_panel = new Panel ();
		_panel.Anchor = ((AnchorStyles) ((((AnchorStyles.Top | AnchorStyles.Bottom)
					| AnchorStyles.Left)
					| AnchorStyles.Right)));
		_panel.BackColor = SystemColors.Window;
		_panel.Controls.Add (_resizeControl);
		_panel.Location = new Point (12, 25);
		_panel.Size = new Size (265, 230);
		_panel.TabIndex = 0;
		Controls.Add (_panel);
		// 
		// _resizeControl
		// 
		_resizeControl.Dock = DockStyle.Fill;
		_resizeControl.Location = new Point (0, 0);
		_resizeControl.Size = new Size (795, 265);
		_resizeControl.TabIndex = 0;
		// 
		// MainForm
		// 
		ClientSize = new Size (500, 326);
		Location = new Point (100, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81199";
		Load += new EventHandler (MainForm_Load);
	}
Example #30
0
	public MainForm ()
	{
		// 
		// _controlA
		// 
		_controlA = new SelectionTestControl ();
		_controlA.Height = 150;
		_controlA.Width = 300;
		Controls.Add (_controlA);
		// 
		// _controlB
		// 
		_controlB = new SelectionTestControl ();
		_controlB.Height = 150;
		_controlB.Width = 300;
		_controlB.Top = _controlA.Bottom;
		Controls.Add (_controlB);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 300);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #322904";
		Load += new EventHandler (MainForm_Load);
	}
Example #31
0
 public ComboBox(Window parent, string value, Point pos, Size size, string[] choices)
     : this(parent, Window.UniqueID, value, pos, size, choices, 0, null, null)
 {
 }
Example #32
0
        protected override void WndProc(ref Message m)
        {
            const int wmNcHitTest   = 0x84;
            const int htLeft        = 10;
            const int htRight       = 11;
            const int htTop         = 12;
            const int htTopLeft     = 13;
            const int htTopRight    = 14;
            const int htBottom      = 15;
            const int htBottomLeft  = 16;
            const int htBottomRight = 17;

            if (m.Msg == wmNcHitTest)
            {
                int   x          = (int)(m.LParam.ToInt64() & 0xFFFF);
                int   y          = (int)((m.LParam.ToInt64() & 0xFFFF0000) >> 16);
                Point pt         = PointToClient(new Point(x, y));
                Size  clientSize = ClientSize;
                ///allow resize on the lower right corner
                if (pt.X >= clientSize.Width - 16 && pt.Y >= clientSize.Height - 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(IsMirrored ? htBottomLeft : htBottomRight);
                    return;
                }
                ///allow resize on the lower left corner
                if (pt.X <= 16 && pt.Y >= clientSize.Height - 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(IsMirrored ? htBottomRight : htBottomLeft);
                    return;
                }
                ///allow resize on the upper right corner
                if (pt.X <= 16 && pt.Y <= 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(IsMirrored ? htTopRight : htTopLeft);
                    return;
                }
                ///allow resize on the upper left corner
                if (pt.X >= clientSize.Width - 16 && pt.Y <= 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(IsMirrored ? htTopLeft : htTopRight);
                    return;
                }
                ///allow resize on the top border
                if (pt.Y <= 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(htTop);
                    return;
                }
                ///allow resize on the bottom border
                if (pt.Y >= clientSize.Height - 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(htBottom);
                    return;
                }
                ///allow resize on the left border
                if (pt.X <= 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(htLeft);
                    return;
                }
                ///allow resize on the right border
                if (pt.X >= clientSize.Width - 16 && clientSize.Height >= 16)
                {
                    m.Result = (IntPtr)(htRight);
                    return;
                }
            }

            switch (m.Msg)
            {
            case WM_NCPAINT:                            // box shadow
                if (m_aeroEnabled)
                {
                    var v = 2;
                    DwmSetWindowAttribute(this.Handle, 2, ref v, 4);
                    MARGINS margins = new MARGINS()
                    {
                        bottomHeight = 1,
                        leftWidth    = 1,
                        rightWidth   = 1,
                        topHeight    = 1
                    };
                    DwmExtendFrameIntoClientArea(this.Handle, ref margins);
                }
                break;

            default:
                break;
            }
            base.WndProc(ref m);
        }
Example #33
0
 protected override void OnResizeEnd(EventArgs e)
 {
     base.OnResizeEnd(e);
     currentSize = this.Size;
     this.UnlockWindow();
 }
Example #34
0
 protected override void OnResizeBegin(EventArgs e)
 {
     currentSize = this.Size;
     base.OnResizeBegin(e);
 }
Example #35
0
 /// <summary>
 /// Reset the ItemMaximumSize to the default value.
 /// </summary>
 public void ResetItemMaximumSize()
 {
     ItemMaximumSize = _defaultItemMaximumSize;
 }
    public void BehaviorAutoSize ()
    {
        if (TestHelper.RunningOnUnix)
            Assert.Ignore ("Depends on font measurements, corresponds to windows");

        Form f = new Form ();
        f.ShowInTaskbar = false;

        f.Show ();

        Image i = new Bitmap (20, 20);
        String s = "My test string";

        Button b = new Button ();
        Size s_size = TextRenderer.MeasureText (s, new Button ().Font);

        b.UseCompatibleTextRendering = false;
        b.AutoSize = true;
        b.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        b.Text = s;
        f.Controls.Add (b);

        // Text only
        b.TextImageRelation = TextImageRelation.Overlay;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + 10), b.Size, "A1");
        b.TextImageRelation = TextImageRelation.ImageAboveText;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + 10), b.Size, "A2");
        b.TextImageRelation = TextImageRelation.ImageBeforeText;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + 10), b.Size, "A3");
        b.TextImageRelation = TextImageRelation.TextAboveImage;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + 10), b.Size, "A4");
        b.TextImageRelation = TextImageRelation.TextBeforeImage;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + 10), b.Size, "A5");

        // Text and Image
        b.Image = i;
        b.TextImageRelation = TextImageRelation.Overlay;
        Assert.AreEqual (new Size (s_size.Width + 10, i.Height + 6), b.Size, "A6");
        b.TextImageRelation = TextImageRelation.ImageAboveText;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + i.Height + 10), b.Size, "A7");
        b.TextImageRelation = TextImageRelation.ImageBeforeText;
        Assert.AreEqual (new Size (s_size.Width + i.Width + 10, i.Height + 6), b.Size, "A8");
        b.TextImageRelation = TextImageRelation.TextAboveImage;
        Assert.AreEqual (new Size (s_size.Width + 10, s_size.Height + i.Height + 10), b.Size, "A9");
        b.TextImageRelation = TextImageRelation.TextBeforeImage;
        Assert.AreEqual (new Size (s_size.Width + i.Width + 10, i.Height + 6), b.Size, "A10");

        // Image only
        b.Text = string.Empty;
        b.TextImageRelation = TextImageRelation.Overlay;
        Assert.AreEqual (new Size (i.Height + 6, i.Height + 6), b.Size, "A11");
        b.TextImageRelation = TextImageRelation.ImageAboveText;
        Assert.AreEqual (new Size (i.Height + 6, i.Height + 6), b.Size, "A12");
        b.TextImageRelation = TextImageRelation.ImageBeforeText;
        Assert.AreEqual (new Size (i.Height + 6, i.Height + 6), b.Size, "A13");
        b.TextImageRelation = TextImageRelation.TextAboveImage;
        Assert.AreEqual (new Size (i.Height + 6, i.Height + 6), b.Size, "A14");
        b.TextImageRelation = TextImageRelation.TextBeforeImage;
        Assert.AreEqual (new Size (i.Height + 6, i.Height + 6), b.Size, "A15");

        // Neither
        b.Image = null;
        b.TextImageRelation = TextImageRelation.Overlay;
        Assert.AreEqual (new Size (6, 6), b.Size, "A16");
        b.TextImageRelation = TextImageRelation.ImageAboveText;
        Assert.AreEqual (new Size (6, 6), b.Size, "A17");
        b.TextImageRelation = TextImageRelation.ImageBeforeText;
        Assert.AreEqual (new Size (6, 6), b.Size, "A18");
        b.TextImageRelation = TextImageRelation.TextAboveImage;
        Assert.AreEqual (new Size (6, 6), b.Size, "A19");
        b.TextImageRelation = TextImageRelation.TextBeforeImage;
        Assert.AreEqual (new Size (6, 6), b.Size, "A20");

        // Padding
        b.Padding = new Padding (5, 10, 15, 20);
        Assert.AreEqual (new Size (6 + b.Padding.Horizontal, 6 + b.Padding.Vertical), b.Size, "A21");

        f.Dispose ();
    }
#pragma warning restore

        public SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
        {
            Size size = Device.Info.ScaledScreenSize;

            return(new SizeRequest(new Size(size.Width, size.Height)));
        }
Example #38
0
 /// <summary>
 /// If the cell is not linked to a grid the result is not accurate (Font can be null). Call InternalMeasure with RowSpan and ColSpan
 /// </summary>
 /// <param name="maxLayoutArea">SizeF structure that specifies the maximum layout area for the text. If width or height are zero the value is set to a default maximum value.</param>
 /// <returns></returns>
 public Size Measure(Size maxLayoutArea)
 {
     return(GetContext().Measure(maxLayoutArea));
 }
Example #39
0
        public bool AutoSize(int availableWidth, int maxWidth)
        {
            bool tooSmall = false;
            bool wordWrap = false;
            Size txtSize  = WinFormUtils.MeasureRichTextBox(toolTipRTB, false, toolTipRTB.Width, toolTipRTB.Height, false);

            // tooltip larger than the window: wrap
            int limitLeft   = ((Form)PluginBase.MainForm).ClientRectangle.Left + 10;
            int limitRight  = ((Form)PluginBase.MainForm).ClientRectangle.Right - 10;
            int limitBottom = ((Form)PluginBase.MainForm).ClientRectangle.Bottom - 26;
            //
            int maxW = availableWidth > 0 ? availableWidth : limitRight - limitLeft;

            if (maxW > maxWidth && maxWidth > 0)
            {
                maxW = maxWidth;
            }

            int w = txtSize.Width + 4;

            if (w > maxW)
            {
                wordWrap = true;
                w        = maxW;
                if (w < 200)
                {
                    w        = 200;
                    tooSmall = true;
                }

                txtSize = WinFormUtils.MeasureRichTextBox(toolTipRTB, false, w, 1000, true);
                w       = txtSize.Width + 4;
            }

            int h  = txtSize.Height + 2;
            int dh = 1;
            int dw = 2;

            if (h > (limitBottom - toolTip.Top))
            {
                w += 15;
                h  = limitBottom - toolTip.Top;
                dh = 4;
                dw = 5;

                toolTipRTB.ScrollBars = RichTextBoxScrollBars.Vertical;
            }

            toolTipRTB.Size = new Size(w, h);
            toolTip.Size    = new Size(w + dw, h + dh);

            if (toolTip.Left < limitLeft)
            {
                toolTip.Left = limitLeft;
            }

            if (toolTip.Left + toolTip.Width > limitRight)
            {
                toolTip.Left = limitRight - toolTip.Width;
            }

            if (toolTipRTB.WordWrap != wordWrap)
            {
                toolTipRTB.WordWrap = wordWrap;
            }

            return(!tooSmall);
        }
Example #40
0
 public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst,
                                               [In] ref Point pptDst, [In] ref Size psize, IntPtr hdcSrc, [In] ref Point pptSrc, uint crKey,
                                               [In] ref BlendFunction pblend, uint dwFlags);
 public Size UnscaleSize(Size s)
 {
     return(new Size(UnscaleScalar(s.Width), UnscaleScalar(s.Height)));
 }
Example #42
0
 public void SetElementSize(Size size)
 {
     Layout.LayoutChildIntoBoundingRegion(Element, new Rectangle(Element.X, Element.Y, size.Width, size.Height));
 }
Example #43
0
 protected override Size MeasureOverride(Size constraint)
 {
     _contentPresenter.Measure(constraint);
     return(new Size(((FrameworkElement)AdornedElement).ActualWidth,
                     ((FrameworkElement)AdornedElement).ActualHeight));
 }
Example #44
0
 protected override Size ArrangeOverride(Size finalSize)
 {
     _contentPresenter.Arrange(new Rect(finalSize));
     return(finalSize);
 }
Example #45
0
 public BgrRenderer(UxContext uxContext, Size textureSize)
 {
     UxContext   = uxContext;
     Texture     = uxContext.GetTexture("bgr.png");
     TextureSize = textureSize;
 }
Example #46
0
        public unsafe VideoFrameConverter(Size sourceSize, AVPixelFormat sourcePixelFormat, Size destinationSize, AVPixelFormat destinationPixelFormat)
        {
            this._destinationSize = destinationSize;
            this._pConvertContext = ffmpeg.sws_getContext(sourceSize.Width, sourceSize.Height, sourcePixelFormat, destinationSize.Width, destinationSize.Height, destinationPixelFormat, 1, null, null, null);
            if (this._pConvertContext == null)
            {
                throw new ApplicationException("Could not initialize the conversion context.");
            }
            int convertedFrameBufferSize = ffmpeg.av_image_get_buffer_size(destinationPixelFormat, destinationSize.Width, destinationSize.Height, 1);

            this._convertedFrameBufferPtr = Marshal.AllocHGlobal(convertedFrameBufferSize);
            this._dstData     = default(byte_ptrArray4);
            this._dstLinesize = default(int_array4);
            ffmpeg.av_image_fill_arrays(ref this._dstData, ref this._dstLinesize, (byte *)(void *)this._convertedFrameBufferPtr, destinationPixelFormat, destinationSize.Width, destinationSize.Height, 1);
        }
Example #47
0
 [DllImport("wx-c"), System.Security.SuppressUnmanagedCodeSecurity] static extern bool   wxComboBox_Create(IntPtr self, IntPtr window, int id, string value, ref Point pos, ref Size size, int n, string[] choices, uint style, IntPtr validator, string name);
Example #48
0
        public void Dump(ILogger logger)
        {
            var totalSize = 0UL;

            foreach (var module in Context.Heap.Runtime.EnumerateModules())
            {
                totalSize += module.Size;

                logger.LogInformation($"Name: {module.Name} AssemblyName: {module.AssemblyName} IsDynamic: {module.IsDynamic} Size: {Size.ToString(module.Size)}");
            }

            logger.LogInformation($"Total size: {Size.ToString(totalSize)}");
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        public void Run(AdManagerUser user)
        {
            using (CreativeService creativeService = user.GetService<CreativeService>())
            {
                // Set the ID of the advertiser (company) that all creatives will be
                // assigned to.
                long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));

                // Create the local custom creative object.
                CustomCreative customCreative = new CustomCreative();
                customCreative.name = "Custom creative " + GetTimeStamp();
                customCreative.advertiserId = advertiserId;
                customCreative.destinationUrl = "http://google.com";

                // Set the custom creative image asset.
                CustomCreativeAsset customCreativeAsset = new CustomCreativeAsset();
                customCreativeAsset.macroName = "IMAGE_ASSET";
                CreativeAsset asset = new CreativeAsset();
                asset.fileName = string.Format("inline{0}.jpg", GetTimeStamp());
                asset.assetByteArray =
                    MediaUtilities.GetAssetDataFromUrl("https://goo.gl/3b9Wfh", user.Config);
                customCreativeAsset.asset = asset;

                customCreative.customCreativeAssets = new CustomCreativeAsset[]
                {
                    customCreativeAsset
                };

                // Set the HTML snippet using the custom creative asset macro.
                customCreative.htmlSnippet = "<a href='%%CLICK_URL_UNESC%%%%DEST_URL%%'>" +
                    "<img src='%%FILE:" + customCreativeAsset.macroName + "%%'/>" +
                    "</a><br>Click above for great deals!";

                // Set the creative size.
                Size size = new Size();
                size.width = 300;
                size.height = 250;
                size.isAspectRatio = false;

                customCreative.size = size;

                try
                {
                    // Create the custom creative on the server.
                    Creative[] createdCreatives = creativeService.createCreatives(new Creative[]
                    {
                        customCreative
                    });

                    foreach (Creative createdCreative in createdCreatives)
                    {
                        Console.WriteLine(
                            "A custom creative with ID \"{0}\", name \"{1}\", and size ({2}, " +
                            "{3}) was created and can be previewed at {4}", createdCreative.id,
                            createdCreative.name, createdCreative.size.width,
                            createdCreative.size.height, createdCreative.previewUrl);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failed to create custom creatives. Exception says \"{0}\"",
                        e.Message);
                }
            }
        }
Example #50
0
 public ComboBox(Window parent, string value, Point pos, Size size, string[] choices, long style, Validator val)
     : this(parent, Window.UniqueID, value, pos, size, choices, style, val, null)
 {
 }
Example #51
0
 public abstract void performLayout(Size size);
Example #52
0
 public Tent(Form canvasHost, Point point)
     : base(canvasHost, point)
 {
     size = new Size(122, 69);
 }
Example #53
0
 public Asteroid(Point pos, Point dir, Size size) : base(pos, dir, size)
 {
     Power = 1;
 }
Example #54
0
 public ComboBox(Window parent, int id, string value, Point pos, Size size, string[] choices, long style)
     : this(parent, id, value, pos, size, choices, style, null, null)
 {
 }
Example #55
0
        private void DrawPieChart(List <ItemClass> data)
        {
            int canvasWidth  = picCanvas.Width;
            int canvasHeight = picCanvas.Height;

            canvas.ResetTransform();
            canvas.TranslateTransform(canvasWidth / 2, canvasHeight / 2);
            canvas.RotateTransform(-90);
            canvas.Clear(Color.White);
            Font         font        = new Font("Ariel", 14, GraphicsUnit.Pixel);
            float        total       = (float)data.Sum(n => n.Data);
            int          graphBuffer = data.Max(n => TextRenderer.MeasureText(string.Format("{0} : {1}", n.Data, n.Name), font).Width);
            Rectangle    border      = new Rectangle(-canvasWidth / 2 + graphBuffer, -canvasHeight / 2 + graphBuffer, canvasWidth - graphBuffer * 2, canvasWidth - graphBuffer * 2);
            float        prevAngle   = 0;
            int          textBuffer  = 5;
            StringFormat format      = new StringFormat();

            format.LineAlignment = StringAlignment.Center;
            format.Alignment     = StringAlignment.Center;

            foreach (ItemClass item in data)
            {
                float itemPercent = (float)item.Data / total;
                float sweepAngle  = itemPercent * 360;
                canvas.FillPie(new SolidBrush(item.Color), border, prevAngle, sweepAngle);

                prevAngle += sweepAngle;
            }
            prevAngle = 0;
            foreach (ItemClass item in data)
            {
                float  itemPercent = (float)item.Data / total;
                float  sweepAngle  = itemPercent * 360;
                string text        = string.Format("{0} : {1}", item.Data, item.Name);
                Size   stringSize  = TextRenderer.MeasureText(text, font);

                if (prevAngle + sweepAngle / 2 < 180)
                {
                    canvas.DrawLine(new Pen(Color.Black, 2), 0, 0, border.Width / 2, 0);
                    canvas.RotateTransform(sweepAngle / 2);
                    canvas.DrawString(text, font, new SolidBrush(Color.Black),
                                      border.Width / 2 + stringSize.Width / 2 + textBuffer,
                                      -stringSize.Height / 2,
                                      format
                                      );
                    canvas.RotateTransform(sweepAngle / 2);
                }
                else
                {
                    canvas.ResetTransform();
                    canvas.TranslateTransform(canvasWidth / 2, canvasHeight / 2);

                    canvas.RotateTransform(-270 + prevAngle);
                    canvas.DrawLine(new Pen(Color.Black, 2), 0, 0, -border.Width / 2, 0);

                    canvas.RotateTransform(sweepAngle / 2);
                    canvas.DrawString(text, font, new SolidBrush(Color.Black),
                                      -(border.Width / 2 + stringSize.Width / 2 + textBuffer),
                                      -stringSize.Height / 2,
                                      format
                                      );
                }

                prevAngle += sweepAngle;
            }
        }
Example #56
0
 internal virtual Android.Graphics.Matrix ToNative(Android.Graphics.Matrix targetMatrix = null, Size size = new Size(), bool isBrush = false)
 {
     throw new NotImplementedException();
 }
Example #57
0
 protected override Size ArrangeOverride(Size finalSize);
Example #58
0
        static void Main(string[] args)
        {
            Settings = new ProgramSettings();

            //System.Threading.Thread.Sleep(30000);

            Parameters parameters = new Parameters();

            try
            {
                CommandLineParser.ParseArguments(parameters, args);
            }
            catch (Exception) { }

            if (parameters.Help)
            {
                using (HelpForm helpForm = new HelpForm())
                {
                    helpForm.ShowDialog();
                    return;
                }
            }

            bool fileLoaded = false;

            if (!string.IsNullOrEmpty(parameters.LoadFile))
            {
                try
                {
                    LoadFile(parameters.LoadFile);
                    fileLoaded = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Invalid settings file.\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (!string.IsNullOrEmpty(parameters.Resolution))
            {
                Regex Validator = new Regex("^\\d*x\\d*$");       // Digits x digits - Width x Height
                if (Validator.IsMatch(parameters.Resolution))
                {
                    int W = Int32.Parse(parameters.Resolution.Substring(0, parameters.Resolution.IndexOf('x')));
                    int H = Int32.Parse(parameters.Resolution.Substring(parameters.Resolution.IndexOf('x') + 1, parameters.Resolution.Length - parameters.Resolution.IndexOf('x') - 1));
                    ForcedResolution = new System.Drawing.Size(W, H);
                }
            }

            if (fileLoaded && parameters.Silent)
            {
                SetWallpaper(null);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
Example #59
0
 protected override Size MeasureOverride(Size availableSize);
Example #60
0
        internal void _callPerformLayout(Size size, RenderBox firstChild) {
            Dictionary<object, RenderBox> previousIdToChild = this._idToChild;

            HashSet<RenderBox> debugPreviousChildrenNeedingLayout = null;
            D.assert(() => {
                debugPreviousChildrenNeedingLayout = this._debugChildrenNeedingLayout;
                this._debugChildrenNeedingLayout = new HashSet<RenderBox>();
                return true;
            });

            try {
                this._idToChild = new Dictionary<object, RenderBox>();
                RenderBox child = firstChild;
                while (child != null) {
                    MultiChildLayoutParentData childParentData = (MultiChildLayoutParentData) child.parentData;
                    D.assert(() => {
                        if (childParentData.id == null) {
                            throw new UIWidgetsError(
                                "The following child has no ID:\n" +
                                $"  {child}\n" +
                                "Every child of a RenderCustomMultiChildLayoutBox must have an ID in its parent data."
                            );
                        }

                        return true;
                    });
                    this._idToChild[childParentData.id] = child;
                    D.assert(() => {
                        this._debugChildrenNeedingLayout.Add(child);
                        return true;
                    });
                    child = childParentData.nextSibling;
                }

                this.performLayout(size);
                D.assert(() => {
                    if (this._debugChildrenNeedingLayout.isNotEmpty()) {
                        if (this._debugChildrenNeedingLayout.Count > 1) {
                            throw new UIWidgetsError(
                                $"The $this custom multichild layout delegate forgot to lay out the following children:\n" +
                                $"  {string.Join("\n  ", this._debugChildrenNeedingLayout.Select(this._debugDescribeChild))}\n" +
                                "Each child must be laid out exactly once."
                            );
                        }
                        else {
                            throw new UIWidgetsError(
                                $"The $this custom multichild layout delegate forgot to lay out the following child:\n" +
                                $"  {this._debugDescribeChild(this._debugChildrenNeedingLayout.First())}\n" +
                                "Each child must be laid out exactly once."
                            );
                        }
                    }

                    return true;
                });
            }
            finally {
                this._idToChild = previousIdToChild;
                D.assert(() => {
                    this._debugChildrenNeedingLayout = debugPreviousChildrenNeedingLayout;
                    return true;
                });
            }
        }