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

C#

 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi210830-Apr-11 23:14
Cadi210830-Apr-11 23:14 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Ghydo1-May-11 8:43
Ghydo1-May-11 8:43 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21081-May-11 9:50
Cadi21081-May-11 9:50 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Ghydo1-May-11 11:07
Ghydo1-May-11 11:07 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21082-May-11 0:26
Cadi21082-May-11 0:26 
AnswerRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Luc Pattyn2-May-11 15:10
sitebuilderLuc Pattyn2-May-11 15:10 
GeneralRe: Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled"" Pin
Cadi21082-May-11 23:36
Cadi21082-May-11 23:36 
Questioni need a help with an analog clock in c# Pin
stranger8030-Apr-11 9:54
stranger8030-Apr-11 9:54 
hi everyone,
this is my first post here.
i need a help please...
(i'm a beginner in c#)
i have to make two analog clocks with visual studio in c#,wich they must be in a different time zone beside each other,one with our time and the second could be any place in the world.
i made the first analog clock and than i copied it and i made a new class for it,but when i start debugging the second clock comes under the first one and attached to it,how can i move the second clock parallel to the right side of the first clock??

this is the main code wich contain the ode of the first clock:

<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Drawing.Drawing2D;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace analoge_uhr<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        private Clock uhr1;<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
           <br />
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
            this.SetStyle(ControlStyles.UserPaint, true);<br />
            this.SetStyle(ControlStyles.DoubleBuffer, true);<br />
            uhr1 = new Clock();<br />
        }<br />
        protected override void OnPaint(PaintEventArgs e)<br />
        {<br />
            base.OnPaint(e);<br />
            System.Drawing.Graphics gr = e.Graphics;<br />
            <br />
            Rectangle rec = new Rectangle(20, 20, 250, 250);<br />
            LinearGradientBrush linearbrush = new LinearGradientBrush(rec, Color.Yellow, Color.Green, 225);<br />
            gr.FillEllipse(linearbrush, 20, 20, 200, 200);<br />
            linearbrush.LinearColors = new Color[] { Color.Silver, Color.Silver, };<br />
            gr.FillEllipse(linearbrush, 30, 30, 180, 180);<br />
            linearbrush.LinearColors = new Color[] { Color.Black, Color.Black };<br />
            gr.FillEllipse(linearbrush, 33, 33, 174, 174);<br />
            SolidBrush solidbrush = new SolidBrush(Color.White);<br />
            Font textFont = new Font("Arial Bold", 12F);<br />
            gr.DrawString("12", textFont, solidbrush, 109, 40);<br />
            gr.DrawString("11", textFont, solidbrush, 75, 50);<br />
            gr.DrawString("10", textFont, solidbrush, 47, 75);<br />
            gr.DrawString("9", textFont, solidbrush, 43, 110);<br />
            gr.DrawString("8", textFont, solidbrush, 52, 145);<br />
            gr.DrawString("7", textFont, solidbrush, 75, 170);<br />
            gr.DrawString("6", textFont, solidbrush, 113, 180);<br />
            gr.DrawString("5", textFont, solidbrush, 150, 170);<br />
            gr.DrawString("4", textFont, solidbrush, 173, 145);<br />
            gr.DrawString("3", textFont, solidbrush, 182, 110);<br />
            gr.DrawString("2", textFont, solidbrush, 173, 75);<br />
            gr.DrawString("1", textFont, solidbrush, 150, 50);<br />
            gr.TranslateTransform(120, 120, MatrixOrder.Append);<br />
            int hour = DateTime.Now.Hour;<br />
            int min = DateTime.Now.Minute;<br />
            int sec = DateTime.Now.Second;<br />
            Pen hourPen = new Pen(Color.White, 2);<br />
            Pen minutePen = new Pen(Color.LightGray, 2);<br />
            Pen secondPen = new Pen(Color.Red, 1);<br />
            double secondAngle = 2.0 * Math.PI * sec / 60.0;<br />
            double minuteAngle = 2.0 * Math.PI * (min + sec / 60.0) / 60.0;<br />
            double hourAngle = 2.0 * Math.PI * (hour + min / 60.0) / 12.0;<br />
            Point centre = new Point(0, 0);<br />
             Point hourHand = new Point((int)(40 * Math.Sin(hourAngle)),<br />
                 (int)(-40 * Math.Cos(hourAngle)));<br />
            gr.DrawLine(hourPen, centre, hourHand);<br />
            Point minHand = new Point((int)(70 * Math.Sin(minuteAngle)),<br />
                (int)(-70 * Math.Cos(minuteAngle)));<br />
            gr.DrawLine(minutePen, centre, minHand);<br />
            Point secHand = new Point((int)(70 * Math.Sin(secondAngle)),<br />
                (int)(-70 * Math.Cos(secondAngle)));<br />
            gr.DrawLine(secondPen, centre, secHand);<br />
           <br />
             uhr1.daw(e.Graphics);<br />
            <br />
            Invalidate();<br />
        }<br />
        <br />
        }  <br />
}<br />


and here is the code for the second clock,wich i opened for it a new class:

<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Drawing;<br />
using System.Drawing.Drawing2D;<br />
<br />
namespace analoge_uhr<br />
{<br />
    class Clock<br />
    {<br />
<br />
          public void daw(System.Drawing.Graphics g){<br />
             <br />
              Rectangle rec = new Rectangle(20, 20, 250, 250);<br />
              LinearGradientBrush linearbrush = new LinearGradientBrush(rec, Color.Blue, Color.BlueViolet, 225);<br />
              g.FillEllipse(linearbrush, 20, 20, 200, 200);<br />
              linearbrush.LinearColors = new Color[] { Color.Silver, Color.Silver, };<br />
              g.FillEllipse(linearbrush, 30, 30, 180, 180);<br />
              linearbrush.LinearColors = new Color[] { Color.Black, Color.Black };<br />
              g.FillEllipse(linearbrush, 33, 33, 174, 174);<br />
              SolidBrush solidbrush = new SolidBrush(Color.White);<br />
              Font textFont = new Font("Arial Bold", 12F);<br />
              g.DrawString("12", textFont, solidbrush, 109, 40);<br />
              g.DrawString("11", textFont, solidbrush, 75, 50);<br />
              g.DrawString("10", textFont, solidbrush, 47, 75);<br />
              g.DrawString("9", textFont, solidbrush, 43, 110);<br />
              g.DrawString("8", textFont, solidbrush, 52, 145);<br />
              g.DrawString("7", textFont, solidbrush, 75, 170);<br />
              g.DrawString("6", textFont, solidbrush, 113, 180);<br />
              g.DrawString("5", textFont, solidbrush, 150, 170);<br />
              g.DrawString("4", textFont, solidbrush, 173, 145);<br />
              g.DrawString("3", textFont, solidbrush, 182, 110);<br />
              g.DrawString("2", textFont, solidbrush, 173, 75);<br />
              g.DrawString("1", textFont, solidbrush, 150, 50);<br />
              g.TranslateTransform(120, 120, MatrixOrder.Append);<br />
              int hour = DateTime.Now.Hour;<br />
              int min = DateTime.Now.Minute;<br />
              int sec = DateTime.Now.Second;<br />
              Pen hourPen = new Pen(Color.White, 2);<br />
              Pen minutePen = new Pen(Color.LightGray, 2);<br />
              Pen secondPen = new Pen(Color.Red, 1);<br />
              double secondAngle = 2.0 * Math.PI * sec / 60.0;<br />
              double minuteAngle = 2.0 * Math.PI * (min + sec / 60.0) / 60.0;<br />
              double hourAngle = 2.0 * Math.PI * (hour + min / 60.0) / 12.0;<br />
              Point centre = new Point(0, 0);<br />
              Point hourHand = new Point((int)(40 * Math.Sin(hourAngle)),<br />
                  (int)(-40 * Math.Cos(hourAngle)));<br />
              g.DrawLine(hourPen, centre, hourHand);<br />
              Point minHand = new Point((int)(70 * Math.Sin(minuteAngle)),<br />
                  (int)(-70 * Math.Cos(minuteAngle)));<br />
              g.DrawLine(minutePen, centre, minHand);<br />
              Point secHand = new Point((int)(70 * Math.Sin(secondAngle)),<br />
                  (int)(-70 * Math.Cos(secondAngle)));<br />
              g.DrawLine(secondPen, centre, secHand);<br />
<br />
            }<br />
    }<br />
 <br />
}<br />
<br />



and thanky you...

modified on Saturday, April 30, 2011 4:31 PM

AnswerRe: hi Pin
Luc Pattyn30-Apr-11 10:14
sitebuilderLuc Pattyn30-Apr-11 10:14 
GeneralRe: hi Pin
stranger8030-Apr-11 10:30
stranger8030-Apr-11 10:30 
QuestionHow do I take the content from a javascript variable, and paste it into a c# variable? Pin
_Q12_30-Apr-11 6:59
_Q12_30-Apr-11 6:59 
AnswerRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Dave Kreskowiak30-Apr-11 10:04
mveDave Kreskowiak30-Apr-11 10:04 
AnswerRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Eddy Vluggen30-Apr-11 22:13
professionalEddy Vluggen30-Apr-11 22:13 
GeneralRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
_Q12_5-May-11 8:26
_Q12_5-May-11 8:26 
GeneralRe: How do I take the content from a javascript variable, and paste it into a c# variable? Pin
Eddy Vluggen5-May-11 9:21
professionalEddy Vluggen5-May-11 9:21 
QuestionUsings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:28
professionalrms12330-Apr-11 2:28 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 2:39
Philippe Mori30-Apr-11 2:39 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:45
professionalrms12330-Apr-11 2:45 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 2:56
Philippe Mori30-Apr-11 2:56 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Philippe Mori30-Apr-11 3:02
Philippe Mori30-Apr-11 3:02 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 [modified some more] Pin
Luc Pattyn30-Apr-11 2:46
sitebuilderLuc Pattyn30-Apr-11 2:46 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 2:54
professionalrms12330-Apr-11 2:54 
AnswerRe: Usings for "ManagementClass" in Visual C# 2010 Pin
Luc Pattyn30-Apr-11 2:59
sitebuilderLuc Pattyn30-Apr-11 2:59 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
rms12330-Apr-11 3:20
professionalrms12330-Apr-11 3:20 
GeneralRe: Usings for "ManagementClass" in Visual C# 2010 Pin
PIEBALDconsult30-Apr-11 3:37
mvePIEBALDconsult30-Apr-11 3:37 

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.