Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

Popup Dialog Position

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Anson - 16 Sep 2007 14:31 GMT
I have created a custom datetimepicker (following on from a previous thread
"DateTimePicker color").

How do I set the position of a Modal Dialog (a control containing a month
calendar) relative to a control (containing a textbox and a button) on a
windows form? I.e. I want the modal dialog to open just beneath the control
that opened the dialog.

Signature

Regards
JTC ^..^

Any other suggestions about creating a custom datetime picker would also be
appreciated.

Nicholas Paldino [.NET/C# MVP] - 16 Sep 2007 14:53 GMT
Dave,

   I would believe it is like any other form.  First, you would set the
StartPosition of the dialog to FormStartPosition.Manual.  You would then set
the Location property to the location that you want it to open.  This
location is relative to the screen.  You would have to calculate the
position based on the control that is showing the dialog.  This can be done
easily with the PointToScreen method on the Control class.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

>I have created a custom datetimepicker (following on from a previous thread
> "DateTimePicker color").
[quoted text clipped - 4 lines]
> control
> that opened the dialog.
Dave Anson - 16 Sep 2007 17:12 GMT
> Dave,
>
[quoted text clipped - 6 lines]
> dialog.  This can be done easily with the PointToScreen method on the
> Control class.

Thanks for the help. The following code resolved the issue....

// Where "this" is my control and, as suggested,
// the "StartPosition" property of the form
// which will appear as a dialog is set to Manual.

_calendarPopUp.Location = this.PointToScreen(new Point(0, this.Height));

// ShowDialog below the control

this._calendarPopUp.ShowDialog();

Signature

Regards
JTC ^..^


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.