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. General Programming
  3. C#
  4. Help me to develop cool date picker.[Windows]

Help me to develop cool date picker.[Windows]

Scheduled Pinned Locked Moved C#
help
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.
  • S Offline
    S Offline
    Sendilkumar M
    wrote on last edited by
    #1

    I want to develop a date picker control which will have cool look-n-feel. My control will be derived from “System.Windows.Forms.Control”.On click event I am trying to show the form which has to “Monthcalendar” control. The problem is the form will not display at the correct position. Help me to determine the position to display the form to get exact appearance of the Windows date picker.

    M.Sendilkumar,Bangalore,India.

    C 1 Reply Last reply
    0
    • S Sendilkumar M

      I want to develop a date picker control which will have cool look-n-feel. My control will be derived from “System.Windows.Forms.Control”.On click event I am trying to show the form which has to “Monthcalendar” control. The problem is the form will not display at the correct position. Help me to determine the position to display the form to get exact appearance of the Windows date picker.

      M.Sendilkumar,Bangalore,India.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, need I say that if you're having trouble positioning the form, writing it may be an issue, too ? You show the form relative to the button, work out how you want it to show relative to the button, and set it's position from the button location.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      S 1 Reply Last reply
      0
      • C Christian Graus

        Well, need I say that if you're having trouble positioning the form, writing it may be an issue, too ? You show the form relative to the button, work out how you want it to show relative to the button, and set it's position from the button location.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        S Offline
        S Offline
        Sendilkumar M
        wrote on last edited by
        #3

        Thats what my problem is.I Set the button's left as form's left and button's top+buttons'height as form's top. This is the logic.

        protected override void OnClick(EventArgs e) { SetAutoLocation(); frmCal.Show(); Invalidate(); } private void SetAutoLocation() { Rect rect; GetWindowRect(this.Handle, out rect); Point tergatePoint; tergatePoint = new Point(rect.left, rect.top + this.Height); tergatePoint = new Point(Left, Top + Height); if (rect.left + this.Width - frmCal.Width < 0) { tergatePoint.X = 0; } else { tergatePoint.X = rect.left - frmCal.Width + this.Width; } if (tergatePoint.X + frmCal.Width > System.Windows.Forms.SystemInformation.WorkingArea.Right) { tergatePoint.X = System.Windows.Forms.SystemInformation.WorkingArea.Right - frmCal.Width; } else if (tergatePoint.X < 0) tergatePoint.X = 0; if (tergatePoint.Y + frmCal.Height > System.Windows.Forms.SystemInformation.WorkingArea.Bottom) { tergatePoint.Y = rect.top - frmCal.Height; } if (tergatePoint.Y < 0) { tergatePoint.Y = 0; } if (tergatePoint.X < 0) { tergatePoint.X = 0; } frmCal.Location = tergatePoint; } public struct Rect { internal int left, top, right, bottom; }

        First click form is not positioning well ,but from second click onwards it is working fine. Can you just see that logic is correct or not?

        M.Sendilkumar

        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