Someone posted the code (shown below) as a way to implement a pop-up
calendar. This code works but how do I get the calendar to pop up exactly
under the column? It pops up close but not exact since it uses the mouse


Previously, someone suggested a method that sort of worked,
which inspired me to do this. Hope this helps!

How to show a dropdown calendar for all datetime fields:
1. Add MonthCalendar control to form. Set visible=false
2. Add a down-arrow button image next to datetime controls.
Name button same as datetime field, but with prefix like
3. Add mouse down function for dw
private void dw_hh_address_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
Sybase.DataWindow.ObjectAtPointer obj =
Sybase.DataWindow.GraphicObject gob = obj.Gob;
System.Drawing.Point pointer;
// see if user clicked on a calendar dropdown button.
if (gob.Name.Substring(0,4) == "ddc")
// save name of datetime field
m_szSelectedDateField = gob.Name.Substring(4);

pointer = Control.MousePosition;

// add offset for dw location. if dw on tab control or
panel, add that location as well
pointer.X -= this.Location.X - dw_hh_address.Location.X +
pointer.Y -= this.Location.Y - dw_hh_address.Location.Y +
MonthCalendar1.Location = pointer;
4. Add DateSelected event code for clicking on calendar
private void m_calUnavailableDate_DateSelected(object
sender, System.Windows.Forms.DateRangeEventArgs e)
dw_hh_address.SetItemDateTime(1, m_szSelectedDateField,
e.Start); // row=1 for a single-row dw form layout. diff
for grid, etc.