نمایش نتایج 1 تا 2 از 2

نام تاپیک: zoom کردن در فرم اصلی

  1. #1
    کاربر تازه وارد
    تاریخ عضویت
    مرداد 1387
    محل زندگی
    ارومیه
    پست
    81

    zoom کردن در فرم اصلی

    سلام من چه جوری می تونم یک شکلی که لر روی فرم رسم شده است رو تغییر اندازه بدم(ZoomInو Zoom Out)

  2. #2
    کاربر دائمی
    تاریخ عضویت
    فروردین 1388
    محل زندگی
    تهران
    پست
    123

    نقل قول: zoom کردن در فرم اصلی


    public partial class Form1 : Form
    {
    Graphics myGraphics;

    public Form1()
    {
    InitializeComponent();
    this.Shown += new EventHandler(Form1_Shown);
    }

    void Form1_Shown(object sender, EventArgs e)
    {
    Button ButtonZoomIn = new Button();
    ButtonZoomIn.Text = "Zoom In";
    ButtonZoomIn.Location = new Point(0, 0);
    Controls.Add(ButtonZoomIn);

    Button ButtonZoomOut = new Button();
    ButtonZoomOut.Text = "Zoom Out";
    ButtonZoomOut.Location = new Point(100, 0);
    Controls.Add(ButtonZoomOut);

    ButtonZoomIn.Click += (s, args) =>
    {
    drawRectangle();
    myGraphics.ScaleTransform(2.0F, 2.0F);
    drawRectangle();
    };

    ButtonZoomOut.Click += (s, args) =>
    {
    drawRectangle();
    myGraphics.ScaleTransform(0.5F, 0.5F);
    drawRectangle();
    };

    myGraphics = this.CreateGraphics();
    drawRectangle();
    }

    void drawRectangle()
    {
    myGraphics.Clear(this.BackColor);
    Rectangle rect = new Rectangle(50, 50, 100, 100);
    SolidBrush brush = new SolidBrush(Color.Black);
    myGraphics.FillRectangle(brush, rect);
    }
    }

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •