PDA

View Full Version : راهنمایی در پروژه Drawing Star



AliRadman
پنج شنبه 08 تیر 1391, 23:10 عصر
سلام
یه پروژه هست
من تا اینجا پیش رفتم که ستاره رو میکشه + یه مربع وسطش برای انتقال و دوران و بزرگ نمایی
88910
برای انتقال و دوران و بزرگنماییش به مشکل خوردم.
ممنون میشم کسی کمک کنه
اینم کد :


public Form1()
{
InitializeComponent();
this.Paint += new PaintEventHandler(Form1_Paint);
//System.Drawing.Pen myPen;
//myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
//System.Drawing.Graphics formGraphics = this.CreateGraphics();
//formGraphics.DrawLine(myPen, 0, 0, 200, 200);
}

static void drawFlag(Graphics g)
{
Point[] star ={
new Point(0,-60), new Point(11,-16),
new Point(58,-16), new Point(18,6),
new Point(40,41), new Point(0,18),
new Point(-40,41), new Point(-18,6),
new Point(-48,-16),new Point(-11,-16)};
Point[] starNormal ={
new Point(0,-50), new Point(11,-16),
new Point(48,-16), new Point(18,6),
new Point(30,41), new Point(0,18),
new Point(-30,41), new Point(-18,6),
new Point(-48,-16),new Point(-11,-16)};
////g.FillRectangle(Brushes.Red, 0, 0, 200, 150);
//g.TranslateTransform(100, 100);
//g.FillPolygon(Brushes.Blue, star);
g.TranslateTransform(150, 150);
g.FillPolygon(Brushes.Blue, star);
g.FillRectangle(Brushes.Red, 0, 0, 5, 5);
}

private void Form1_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Graphics graphicsObj;

graphicsObj = this.CreateGraphics();

drawFlag(graphicsObj);
//Pen myPen = new Pen(System.Drawing.Color.Green, 5);
//Rectangle myRectangle = new Rectangle(20, 20, 250, 200);
//graphicsObj.DrawEllipse(myPen, myRectangle);
}

private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (e.Location.X >= 100 && e.Location.X <= 104)
MessageBox.Show(e.Location.X.ToString());
}http://barnamenevis.org/images/misc/pencil.png

the king
جمعه 09 تیر 1391, 03:22 صبح
نمونه پروژه ضمیمه این پست می باشد.