Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. motionless analog clock

motionless analog clock

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netalgorithms
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hemant Thaker
    wrote on last edited by
    #1

    Hi.. I want to display motionless analog clock. (asp.net + C#) I have 3 textboxes and entering HH, MM, SS. Clicking the button would generate analog clock with the respective time. Did lot of searching but didnt get my way out.. please suggest me some way. thanks,

    By: Hemant Thaker

    S 1 Reply Last reply
    0
    • H Hemant Thaker

      Hi.. I want to display motionless analog clock. (asp.net + C#) I have 3 textboxes and entering HH, MM, SS. Clicking the button would generate analog clock with the respective time. Did lot of searching but didnt get my way out.. please suggest me some way. thanks,

      By: Hemant Thaker

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      Hemant Thaker wrote:

      Did lot of searching but didnt get my way out..

      Apart from searching what have your tried from your side in order to write code for it? Sound's like a typical homework question. What are the things you plan to use in order to generate this analog clock? Graphics? Javascript? Image? What's your thought and plan?

      H 1 Reply Last reply
      0
      • S Sandeep Mewara

        Hemant Thaker wrote:

        Did lot of searching but didnt get my way out..

        Apart from searching what have your tried from your side in order to write code for it? Sound's like a typical homework question. What are the things you plan to use in order to generate this analog clock? Graphics? Javascript? Image? What's your thought and plan?

        H Offline
        H Offline
        Hemant Thaker
        wrote on last edited by
        #3

        private void drawclock4(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rec = new Rectangle(20, 20, 250, 250); LinearGradientBrush linearbrush = new LinearGradientBrush(rec, Color.Black, Color.Black, 225); g.FillEllipse(linearbrush, 20, 20, 200, 200); linearbrush.LinearColors = new Color[] { Color.White, Color.White, }; g.FillEllipse(linearbrush, 30, 30, 180, 180); linearbrush.LinearColors = new Color[] { Color.White, Color.White }; g.FillEllipse(linearbrush, 33, 33, 174, 174); SolidBrush solidbrush = new SolidBrush(Color.Black); Font textFont = new Font("Arial Black", 12F); g.DrawString("12", textFont, solidbrush, 109, 40); g.DrawString("11", textFont, solidbrush, 75, 50); g.DrawString("10", textFont, solidbrush, 47, 75); g.DrawString("9", textFont, solidbrush, 43, 110); g.DrawString("8", textFont, solidbrush, 52, 145); g.DrawString("7", textFont, solidbrush, 75, 170); g.DrawString("6", textFont, solidbrush, 113, 180); g.DrawString("5", textFont, solidbrush, 150, 170); g.DrawString("4", textFont, solidbrush, 173, 145); g.DrawString("3", textFont, solidbrush, 182, 110); g.DrawString("2", textFont, solidbrush, 173, 75); g.DrawString("1", textFont, solidbrush, 150, 50); g.TranslateTransform(120, 120, MatrixOrder.Append); int hour = DateTime.Now.Hour; int min = DateTime.Now.Minute; int sec = DateTime.Now.Second; // Create Pens Pen hourPen = new Pen(Color.DarkBlue, 4); Pen minutePen = new Pen(Color.DarkGreen, 3); Pen secondPen = new Pen(Color.DarkRed, 2); // Create angles double secondAngle = 2.0 * Math.PI * sec / 60.0; double minuteAngle = 2.0 * Math.PI * (min + sec / 60.0) / 60.0; double hourAngle = 2.0 * Math.PI * (hour + min / 60.0) / 12.0; // Set centre point Point centre = new Point(0, 0); // Draw Hour Hand //Point hourHand = new Point((int)(40 * Math.Sin(hourAngle)), (int)(-40 * Math.Cos(hourAngle))); //g.DrawLine(hourPen, centre, hourHand); // Draw Minute Hand

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups