Thanks... I've incidentally solved my problem setting the
Graphics.PixelOffsetMode to HighQuality....
I think .NET needs more documentation... (although it's already much better
"Bob Powell [MVP]" wrote:
> All in the order...
>
> e.Graphics.ResetTransform();
> e.Graphics.TranslateTransform(-3, -40);
> e.Graphics.RotateTransform(i * 30);
> e.Graphics.TranslateTransform(100, 100);
> e.Graphics.DrawImage(c.CetBitmap, 0, 0);
>
>
> --
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
>
http://www.ramuseco.com >
> Find great Windows Forms articles in Windows Forms Tips and Tricks
>
http://www.bobpowell.net/tipstricks.htm >
> Answer those GDI+ questions with the GDI+ FAQ
>
http://www.bobpowell.net/faqmain.htm >
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
> "thenext1" <thenext1@discussions.microsoft.com> wrote in message
> news:EC30BFDC-519B-4DA9-AC3D-6272623BF1DF@microsoft.com...
> >I have an image representing a clock's minute hand and which I need to draw
> > in the 12 positions.
> > After fiddling a bit, i noticed that there's a strange offset from the
> > hand
> > in one position (i.e. 3 PM) and the opposite (9 PM).
> > It seems that the RotateTransform function i'm using doesn't work
> > correctly,
> > or alternatively that I can't manage to horizontally center the point of
> > rotation so that it rotates around an odd position.
> >
> > To understand what I mean look here:
> >
http://gemini.dynalias.net/web3/clock-net.png > > The code I use for this drawing is the following:
> > float t = 0;
> > for (int i = 0; i < 12; i++)
> > {
> > e.Graphics.ResetTransform();
> > e.Graphics.TranslateTransform(100, 100);
> > e.Graphics.RotateTransform(i * 30);
> > e.Graphics.TranslateTransform(-3, -40);
> > e.Graphics.DrawImage(c.CetBitmap, 0, 0);
> > }
> > The png's width is 6 (hence, translated back 3 pixels)
> >
> >
> >
> > Furthermore I tried doing the same thing with java's Graphics2d class, and
> > it works correctly:
http://gemini.dynalias.net/web3/clock-java.png > > The hand is perfectly aligned and coincident when in opposite positions.
> > The java code is:
> > AffineTransform base = g2d.getTransform();
> > for (int i = 0; i < 12; i++) {
> > g2d.setTransform(base);
> > g2d.translate(100,100);
> > g2d.rotate(i*Math.PI/6);
> > g2d.translate(-3, -40.0);
> > g2d.drawImage(NewJFrame.m, 0, 0, this);
> > }
> >
> >
> > many thanks in advance