views:

10

answers:

1

I'm making Windows Form App in C sharp 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)

A: 

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);
    }
Philip