Hello everybody,
I want to translate a Rectangle, but I can't do it. I've already spent a lot
of time, so I send this email. I have no idea what to do.
The code is below.
Thanks!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Translation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
path.AddRectangle(new Rectangle(100, 100, 20, 20));
}
Graphics g;
GraphicsPath path = new GraphicsPath();
Rectangle r = new Rectangle(100,100,100,100);
private static Color corAtual = Color.Black;
private static Color corTransparente = Color.FromArgb(75,
corAtual.R, corAtual.G, corAtual.B);
Pen p = new Pen(corTransparente);
SolidBrush pincel = new SolidBrush(corTransparente);
private void Form1_Paint(object sender, PaintEventArgs e)
{
g = e.Graphics;
GraphicsPathIterator iterator = new GraphicsPathIterator(path);
iterator.Rewind();
for (int current = 0; current < iterator.SubpathCount;
current++)
{
GraphicsPath p= new GraphicsPath();
iterator.NextMarker(p);//vai para o proximo
shape
g.FillPath(pincel, p);
}
}
private void button1_Click(object sender, EventArgs e)
{
*Matrix m = new Matrix();
m.Translate(200, 200);
path.Transform(m);* //it doesn't work!
}
}
}
--
Ramon Pereira Lopes