Click here to Skip to main content
15,887,337 members
Home / Discussions / C#
   

C#

 
GeneralRe: Opening a comma delimited file in a spread sheet program Pin
Spacix One7-May-08 3:04
Spacix One7-May-08 3:04 
QuestionHow to print data to screen in C# Pin
mary okon6-May-08 15:29
mary okon6-May-08 15:29 
AnswerRe: How to print data to screen in C# Pin
Christian Graus6-May-08 15:37
protectorChristian Graus6-May-08 15:37 
GeneralRe: How to print data to screen in C# Pin
mary okon6-May-08 15:41
mary okon6-May-08 15:41 
AnswerRe: How to print data to screen in C# Pin
javedk096-May-08 20:01
javedk096-May-08 20:01 
QuestionChat Building - transfering data between server and client Pin
nelsonpaixao6-May-08 15:03
nelsonpaixao6-May-08 15:03 
AnswerRe: Chat Building - transfering data between server and client Pin
Reelix6-May-08 21:10
Reelix6-May-08 21:10 
QuestionGetting an Angle for Rotations Pin
RedHotFunk6-May-08 14:28
RedHotFunk6-May-08 14:28 
I'm trying to create an application that rotates an image based on the an angle created by your mouse from a certain point on the form.

I create a form, 500x500, and specify the point to get my angle from at (500,250). From that, everytime the mouse is moved, I grab the current x and y position of the mouse, and then using trig, try to find the angle from the point specified on the form to the mouse. However, I'm not sure if I'm approaching this correctly. Whenever I test my application, the image does rotate, however, it's very "hit-and-miss", and coincidentally, is even quite dodgy in some areas (it wont rotate in certain areas on the form). To rotate the image, I'm using matrices and I haven't had a problem rotating the image using a counter for the angle within a timer; but when I try to use mouse move... well you can only understand where I'm coming from.

Note: I commented out another method I thought off in order to prevent large jumps in the angles, however, it seems to do worse then the other method

   private void Form1_MouseMove(object sender, MouseEventArgs e)<br />
        {<br />
            try<br />
            {<br />
<br />
                rotationz = true;<br />
                //curangle = (float)((Math.Atan((500 - e.Y) / (250 - e.X))) * (-180 / Math.PI));<br />
                angle = (float)((Math.Atan((500 - e.Y) / (250 - e.X))) * (-180 / Math.PI));<br />
                Invalidate();<br />
                //angle = lastangle - curangle;<br />
                //lastangle = curangle;<br />
<br />
            }<br />
            catch (DivideByZeroException)<br />
            {<br />
            }<br />
        }


I'm somewhat of a beginner, so if it is possible to keep it simplified/dumb downed so that it's easier for me to understand, it would be much appreciated! Thanks in advance Smile | :)
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 
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 

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.