Click here to Skip to main content
15,904,652 members
Home / Discussions / C#
   

C#

 
AnswerRe: Getting an Angle for Rotations Pin
Christian Graus6-May-08 15:42
protectorChristian Graus6-May-08 15:42 
GeneralRe: Getting an Angle for Rotations Pin
RedHotFunk7-May-08 16:00
RedHotFunk7-May-08 16:00 
it rotates the original image, not the rotated one, so i don't have to subtract the last angle from the current one. I got something working actually, but it's a bit ridiculous, perhaps anyone else could simplify my code?

try<br />
            {<br />
                //rotationz = true;<br />
<br />
                if (e.X > 250 && e.X < lastx)<br />
                {<br />
                    //right side, positive instance (going left)<br />
                    curangle = (int)((Math.Atan((500 - e.Y) / (250 - e.X))) * (-180 / Math.PI));<br />
                }<br />
                else if (e.X > 250 && e.X > lastx)<br />
                {<br />
                    //right side, negative instance (going right)<br />
                    curangle = (int)((Math.Atan((500 - e.Y) / (250 - e.X))) * (180 / Math.PI));<br />
                    curangle = -180 - curangle;<br />
                }<br />
                if (e.X < 250 && e.X < lastx)<br />
                {<br />
                    //left side, positive instance (going left)<br />
                    curangle = (int)((Math.Atan((500 - e.Y) / (250 - e.X))) * (180 / Math.PI));<br />
                    curangle = 180 - curangle;<br />
                }<br />
                else if (e.X < 250 && e.X > lastx)<br />
                {<br />
                    //left side, negative instance (going right)<br />
                    curangle = (int)((Math.Atan((500 - e.Y) / (250 - e.X))) * (-180 / Math.PI));<br />
                }<br />
<br />
            }<br />
            catch (DivideByZeroException)<br />
            {


For some of those, you'll notice my curangle is touched upon once again within the if statements; I only did that in order to account for both positive and negative rotations left and right. It's kinda long though, so any suggestions would be great Big Grin | :-D ! Thanks again for the help guys!
AnswerRe: Getting an Angle for Rotations Pin
Reelix6-May-08 21:26
Reelix6-May-08 21:26 
QuestionMdi Child Pin
hadad6-May-08 12:53
hadad6-May-08 12:53 
AnswerRe: Mdi Child Pin
Anindya Chatterjee6-May-08 18:52
Anindya Chatterjee6-May-08 18:52 
QuestionC# background Worker and Progress Bar help Pin
Relentless6-May-08 11:35
Relentless6-May-08 11:35 
AnswerRe: C# background Worker and Progress Bar help Pin
Christian Graus6-May-08 11:38
protectorChristian Graus6-May-08 11:38 
GeneralRe: C# background Worker and Progress Bar help Pin
Relentless6-May-08 11:42
Relentless6-May-08 11:42 
AnswerRe: C# background Worker and Progress Bar help Pin
Gareth H6-May-08 11:59
Gareth H6-May-08 11:59 
AnswerRe: C# background Worker and Progress Bar help Pin
GuyThiebaut6-May-08 12:24
professionalGuyThiebaut6-May-08 12:24 
GeneralRe: C# background Worker and Progress Bar help Pin
Relentless6-May-08 13:08
Relentless6-May-08 13:08 
GeneralRe: C# background Worker and Progress Bar help Pin
Christian Graus6-May-08 13:11
protectorChristian Graus6-May-08 13:11 
GeneralRe: C# background Worker and Progress Bar help Pin
Relentless6-May-08 13:13
Relentless6-May-08 13:13 
GeneralRe: C# background Worker and Progress Bar help Pin
Christian Graus6-May-08 13:24
protectorChristian Graus6-May-08 13:24 
QuestionWriting output in a windows application Pin
Jerry Graham6-May-08 11:21
Jerry Graham6-May-08 11:21 
AnswerRe: Writing output in a windows application Pin
Pete O'Hanlon6-May-08 11:28
mvePete O'Hanlon6-May-08 11:28 
GeneralRe: Writing output in a windows application Pin
Jerry Graham6-May-08 11:30
Jerry Graham6-May-08 11:30 
AnswerRe: Writing output in a windows application Pin
Gareth H6-May-08 11:30
Gareth H6-May-08 11:30 
AnswerRe: Writing output in a windows application Pin
PIEBALDconsult6-May-08 13:46
mvePIEBALDconsult6-May-08 13:46 
QuestionGet mouse coordinates relative to control in separate application... Pin
Edmundisme6-May-08 10:40
Edmundisme6-May-08 10:40 
AnswerRe: Get mouse coordinates relative to control in separate application... Pin
Christian Graus6-May-08 11:37
protectorChristian Graus6-May-08 11:37 
GeneralRe: Get mouse coordinates relative to control in separate application... Pin
Edmundisme7-May-08 8:21
Edmundisme7-May-08 8:21 
QuestionWindows Service - Service Thread Not Starting Pin
ooten146-May-08 10:03
ooten146-May-08 10:03 
AnswerRe: Windows Service - Service Thread Not Starting Pin
PIEBALDconsult6-May-08 13:45
mvePIEBALDconsult6-May-08 13:45 
GeneralRe: Windows Service - Service Thread Not Starting Pin
ooten147-May-08 9:16
ooten147-May-08 9:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.