Message-ID: <3C6022A3.8040606@huckfinn.de> Date: Tue, 05 Feb 2002 19:21:23 +0100 From: Alex Weidauer User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.3) Gecko/20010801 X-Accept-Language: de-de, en-us MIME-Version: 1.0 Newsgroups: borland.public.delphi.graphics Subject: Re: Rotate an Ellipse References: <3c5fe6d5$1_2@dnews> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.226.142.145 X-Trace: dnews 1012933073 62.226.142.145 (5 Feb 2002 10:17:53 -0800) Lines: 26 Path: dnews Xref: dnews borland.public.delphi.graphics:45901 TJ wrote: >I create an object based off of TGraphicControl and I used the TCanvas.Ellipse method to create an ellipse. I would like to give the user the ability to rotate this ellipse. I would also like to give the user the ability after rotating the ellipse to still adjust the size and shape. > >If anyone has any idea about how to go about doing this I would greatly appreciate it. > You can use Win32GDI Routines. It works like this. Procedure RotatedEllipse(aCanvas:TCanvas;X1,Y1,X2,Y2:Integer); Var T,O:TXForm; // in unit Windows Begin.. SetGraphicsMode(aCanvas.Handle,GM_Advanced); GetWorldTransform(aCanvas.Handle,O); // Angle in degree T.eM11:=1* Cos(w/360*Pi*2); T.eM22:=1* Cos(w/360*Pi*2); T.eM12:=1* Sin(w/360*Pi*2); T.eM21:=1*-Sin(w/360*Pi*2); T.eDX:=Round((X1+X2)/2); T.eDY:=Round((Y1+Y2))/2); ModifyWorldTransform(aCanvas.Handle,T,MWT_LEFTMULTIPLY); aCanvas.Ellipse(X1,Y1,X2,Y2) SetWorldTransform(TheDraw.Handle,O); End;