Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drag Drop (Read 3451 times)
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Drag Drop
Feb 16th, 2017 at 9:01pm
Print Post  
When I drag/drop onto the calendar it returns the date after the date column in my timetable view. I am using the following code in the calendar DragDrop event:

Private Sub calendar_DragDrop(byVal sender as Object, ByVal e as System.Window.Forms.DragEventArgs) Handles calendar.DragDrop

theSelecteDate = calendar.GetDateAt(e.X, e.Y)

End Sub

So if my cursor is in the 02/01 column it returns 02/02 as theSelectedDate. What am I dong wrong?

Thank you,
John Lee
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Drag Drop
Reply #1 - Feb 17th, 2017 at 9:22am
Print Post  
Hi,

The X and Y values of the DragEventArgs class specify mouse position in screen coordinates, while the Calendar.GetDateAt method expects the provided arguments to be in client (for the Calendar control) coordinates. You need to convert the coordinates before calling GetDateAt:

Code
Select All
Dim clientPoint As Point = calendar.PointToClient(New Point(e.X, e.Y))
Dim theSelecteDate As DateTime = calendar.GetDateAt(clientPoint.X, clientPoint.Y) 


Regards,
Meppy
  
Back to top
 
IP Logged
 
Forum Admin
YaBB Administrator
*****
Offline


Rock and Roll

Posts: 685
Joined: Apr 6th, 2003
Visio import for BPMN templates
Reply #2 - Feb 17th, 2017 at 12:20pm
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
WWW  
IP Logged
 
john6630
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 74
Joined: Sep 20th, 2010
Re: Drag Drop
Reply #3 - Feb 17th, 2017 at 3:30pm
Print Post  
Thank you for the fast and accurate reply (as usual), Meppy!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint