Windows Explorer / Aero Tips in C #?

If you are using Windows Vista or higher, you probably saw a tooltip with colored text and an icon:

enter image description here

I was looking for the use of various keywords, for example. Explorer, Aero, Windows, tooltips and do not have any useful information on how to achieve this.

It is advisable that the solution is for WinForms. Is anyone lucky?

+5
source share
2 answers

This wyDay blog post has a solution.

He refers to 3 parts of a series called "Dragging and dropping shell styles into .NET":

3 , . , DragDropLib WpfDragDropLib, .

, :

#region Drop target accepting FileDrop

private void textBox2_DragEnter(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
    {
        e.Effect = e.AllowedEffect & DragDropEffects.Copy;
        DropTargetHelper.DragEnter(textBox2, e.Data, new Point(e.X, e.Y), e.Effect, "Copy to %1", "Here");
    }
    else
    {
        e.Effect = DragDropEffects.None;
        DropTargetHelper.DragEnter(textBox2, e.Data, new Point(e.X, e.Y), e.Effect);
    }
}

private void textBox2_DragOver(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
        e.Effect = e.AllowedEffect & DragDropEffects.Copy;
    else
        e.Effect = DragDropEffects.None;
    DropTargetHelper.DragOver(new Point(e.X, e.Y), e.Effect);
}

private void textBox2_DragLeave(object sender, EventArgs e)
{
    DropTargetHelper.DragLeave(textBox2);
}

private void textBox2_DragDrop(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
        e.Effect = e.AllowedEffect & DragDropEffects.Copy;
    else
        e.Effect = DragDropEffects.None;
    DropTargetHelper.Drop(e.Data, new Point(e.X, e.Y), e.Effect);

    if (e.Effect == DragDropEffects.Copy)
        AcceptFileDrop(textBox2, e.Data);
}

#endregion // Drop target accepting FileDrop

, e.Effect = DragDropEffects.Copy; e.Effect = e.AllowedEffect & DragDropEffects.Copy;; , &, - . , , drop drop .

, .

, , .

+8

All Articles