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

نام تاپیک: paint در C#‎

  1. #1

    Red face paint در C#‎

    وقت همگی بخیر
    من یه paint در C#‎ طراحی کردم اما میخوام شکلی مثل دایره رو بچرخونم و نمیخوام اونوبه صورت عکس ذخیره و بعد بچرخونم . هرکی میتونه کمک کنه
    اجرتون من الله.....
    اینم کد نوشته شده:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace paint1
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    Graphics pic;
    Bitmap bitmap;
    Pen pen1;
    int x1, y1, y2, x2,x3,y3;
    string num;
    Color color1;
    Brush brush;



    private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
    {
    x1 = e.X;
    y1 = e.Y;
    }

    private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
    {
    x3 = x2;
    y3 = y2;
    x2 = e.X;
    y2 = e.Y;
    }

    private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
    {
    Draw();
    }

    private void Draw()
    {
    bitmap = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb );
    pen1 = new Pen(color1 , 2);
    pic = pictureBox1.CreateGraphics();
    switch(num)
    {
    case "rectangle": pic.DrawRectangle(pen1, x1, y1, x2, y2);
    break;
    case "line": pic.DrawLine(pen1 ,new PointF(x1,y1),new PointF(x2,y2 ));
    break;
    case "circle": pic.DrawEllipse(pen1, x1, y1, x2, y2);
    break;
    case "multi line":
    pic.DrawPolygon(pen1 , new Point[]{ new Point(x1,y1), new Point(x2,y2)});
    x1 = x3;
    y1 = y3;
    break;
    case "elips": pic.FillEllipse (brush , x1, y1, x2, y2);
    break;

    }
    }

    private void button5_Click(object sender, EventArgs e)
    {
    DialogResult re;
    re = colorDialog1.ShowDialog();
    if (re == DialogResult.OK )
    color1 = colorDialog1.Color;
    // brush = Brushes.color1;
    }

    private void button3_Click(object sender, EventArgs e)
    {
    num = "rectangle";
    }

    private void button1_Click(object sender, EventArgs e)
    {
    num = "line";
    }

    private void button6_Click(object sender, EventArgs e)
    {
    num = "circle";
    }

    private void button2_Click(object sender, EventArgs e)
    {
    num = "multi line";
    }

    private void button4_Click(object sender, EventArgs e)
    {
    num = "elips";
    }

    private void ChangeColor(Color color, MouseEventArgs e)
    {
    if (e.Button == MouseButtons.Left)
    {
    color1 = color;
    FrontColor.BackColor = color;
    }
    else
    if (e.Button == MouseButtons.Right)
    {
    color1 = color;
    BackColor.BackColor = color;
    }
    }

    private void picBlack_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Black, e);
    }

    private void picDarkGray_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.DarkGray, e);
    }

    private void picMaroon_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Maroon, e);
    }

    private void picOlive_MouseDown(object sender, MouseEventArgs e)
    {

    ChangeColor(Color.Olive, e);
    }

    private void picGreen_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Green, e);
    }

    private void picTeal_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Teal, e);
    }

    private void picNavy_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Navy, e);
    }

    private void picPurple_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Purple, e);
    }

    private void picDarkKhaki_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.DarkKhaki, e);
    }

    private void picDarkGreen_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.DarkGreen, e);
    }

    private void picDodgerBlue_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.DodgerBlue, e);
    }

    private void picDarkSlateGray_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.DarkSlateGray, e);
    }

    private void pictureMediumSlateBlue_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.MediumSlateBlue, e);
    }

    private void pictureSaddleBrown_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.SaddleBrown, e);
    }

    private void picWhite_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.White, e);
    }




    private void picYellow_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Yellow, e);
    }

    private void picLime_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Lime, e);
    }



    private void picBlue_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Blue, e);
    }


    private void picLemonChiffon_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.LemonChiffon, e);
    }



    private void picCyan_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Cyan, e);
    }

    private void picFuchsia_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Fuchsia, e);
    }

    private void picGreenYellow_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.GreenYellow, e);
    }

    private void picSkyBlue_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.SkyBlue, e);
    }

    private void picPlum_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Plum, e);
    }

    private void picDeepPink_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.DeepPink, e);
    }

    private void picCoral_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Coral, e);
    }

    private void picLightGray_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.LightGray, e);
    }

    private void picRed_MouseDown(object sender, MouseEventArgs e)
    {
    ChangeColor(Color.Red, e);
    }
    }}
    اینم نمای فرمه البته زیاد ایراد داره...
    [IMG]file:///C:/DOCUME%7E1/OPERAT%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/OPERAT%7E1/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG]

  2. #2
    کاربر دائمی آواتار ricky22
    تاریخ عضویت
    مرداد 1386
    محل زندگی
    شیراز
    پست
    1,591

    نقل قول: paint در C#‎

    میشه لطفا پروژتون رو up کنید

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

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