I'm making Windows Form App in C# and best control for what I need is ActiveX Control (Calendar). The problem is that I need drag and drop but Control that I use does not have events for it (only positive thing is that it has property "AllowDrop"). (Control is Xtreme Calendar - Codejock)
I did somehow managed to do it. Using ListBox and it's events MouseDown (to get data with IndexFromPoint method) and MouseUp (to call Calendar's DoubleClick event).
private string name = string.Empty;
private void lstNames_MouseDown(object sender, MouseEventArgs e)
{
if (lstNames.Items.Count == 0)
name = string.Empty;
else
{
int index = lstNames.IndexFromPoint(e.X, e.Y);
name = lstNames.Items[index].ToString();
}
}
private void lstNames_MouseUp(object sender, MouseEventArgs e)
{
if (name != string.Empty)
CalendarControl_DblClick(name, null);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.