Click here to Skip to main content
15,888,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: Left Function in C# Pin
Eric Dahlvang20-Sep-06 4:33
Eric Dahlvang20-Sep-06 4:33 
GeneralRe: Left Function in C# Pin
samtam20-Sep-06 20:26
samtam20-Sep-06 20:26 
QuestionHow to capture the URL? Pin
zhoujun19-Sep-06 5:11
zhoujun19-Sep-06 5:11 
QuestionCalculating scientific notation? Pin
Goalie3519-Sep-06 5:10
Goalie3519-Sep-06 5:10 
AnswerRe: Calculating scientific notation? Pin
Stefan Troschuetz19-Sep-06 5:24
Stefan Troschuetz19-Sep-06 5:24 
QuestionSet resolution in Metafiles Pin
cubeccu19-Sep-06 5:07
cubeccu19-Sep-06 5:07 
Questionwriting to string resource Pin
likefood19-Sep-06 4:57
likefood19-Sep-06 4:57 
QuestionProblems with a custom tooltip [modified] Pin
Gags66619-Sep-06 4:36
Gags66619-Sep-06 4:36 
Hi there!

I've made some kind of tooltip for items included in a ListBox which appears near the cursor when the it's hovering an item in the ListBox.
Because I didn't knew better how to make a tooltip I did it with a simple Windows-Form with some options to make it look like a nice tooltip. When an item in the listbox is hovered by the mouse the tooltip shows up as I want it to. But I still have a few problems:

1. The tooltip-window is always getting the focus and that makes the main-form flickering. How can I prevent this? I set the focus back manually but it's still flickering a bit. Best thing would be the focus wouldn't change at all or something like that.

2. Setting the location for the tooltip makes it act weird. When I set it in the constructor or after the initialization of the tooltip (with this.Top and this.Left as well es with this.Location both based on Cursor.Position) it always appears at the same starting location. By moving the mouse and triggering the event it's moving along across the screen but always on the same route ignoring the cursor-position (seems like the position is stacking its values somehow). When I set it after displaying the form (with Show()) it works.

3. Is this actually the right way to create a tooltip or something like a flying info-box? (I mean by using a Windows-Form and opening it on demand.) It doesn't seem so for me because of the problems I have it looks like it's not ment to be done this way.

I hope someone can help me. Frown | :(

Maybe you want to see the code of my MouseMove-Event:
int taskIndex = listBoxTasks.IndexFromPoint(e.Location);

if (taskIndex > -1) // Check if there's an item under the cursor.
{
    Task currentTask = ((Task)bindingSourceTasks[taskIndex]); // Get the current item.

    if (currentTask != lastTask) // Check if it's not the same like before.
    {
        if (tooltip != null) // Check if tooltip is already open.
        {
            tooltip.Close();
        }

        tooltip = new frmTooltipComponent(currentTask); // Open new tooltip.
        tooltip.Show(); // Show tooltip;
        this.Focus(); // Set focus back to main window.
        tooltip.Top = Cursor.Position.Y; // Set tooltip Y-position.
        tooltip.Left = Cursor.Position.X + 50; // Set tooltip X-position.
        lastTask = currentTask;  // Remember current item.
    }
    else // If same item like before just set new tooltip position.
    {
        tooltip.Top = Cursor.Position.Y; // Set tooltip X-position.
        tooltip.Left = Cursor.Position.X + 50; // Remember current item.
    }
}
else if (tooltip != null) // If no hovered item check if tooltip is open.
{
    tooltip.Close(); // Close tooltip.
    lastTask = null; // Clear last remembered item.
}


In MouseOut-Event of the ListBox I'm also closing the tooltip and clearing the last remembered item.


-- modified at 11:15 Tuesday 19th September, 2006
Questionhow we I call a method from other .cs file... Pin
irkahc19-Sep-06 3:23
irkahc19-Sep-06 3:23 
AnswerRe: how we I call a method from other .cs file... Pin
albCode19-Sep-06 4:22
albCode19-Sep-06 4:22 
GeneralRe: how we I call a method from other .cs file... Pin
irkahc19-Sep-06 17:34
irkahc19-Sep-06 17:34 
GeneralRe: how we I call a method from other .cs file... Pin
irkahc19-Sep-06 19:58
irkahc19-Sep-06 19:58 
AnswerRe: how we I call a method from other .cs file... Pin
Christian Graus19-Sep-06 11:30
protectorChristian Graus19-Sep-06 11:30 
Questionhow do you write this vb line in c# Pin
faladrim19-Sep-06 3:03
faladrim19-Sep-06 3:03 
AnswerRe: how do you write this vb line in c# Pin
Ravi Bhavnani19-Sep-06 3:13
professionalRavi Bhavnani19-Sep-06 3:13 
QuestionHow can I start Lotus Notes V5 or V6 with attachements in C#.NET? Pin
MDT Daniel19-Sep-06 2:55
MDT Daniel19-Sep-06 2:55 
AnswerRe: How can I start Lotus Notes V5 or V6 with attachements in C#.NET? Pin
unclepaul19-Sep-06 5:23
unclepaul19-Sep-06 5:23 
GeneralRe: How can I start Lotus Notes V5 or V6 with attachements in C#.NET? Pin
MDT Daniel19-Sep-06 20:10
MDT Daniel19-Sep-06 20:10 
QuestionSupressing a console window of and another exe Pin
Pavan Josh19-Sep-06 2:31
Pavan Josh19-Sep-06 2:31 
AnswerRe: Supressing a console window of and another exe Pin
Alper Camel19-Sep-06 4:37
Alper Camel19-Sep-06 4:37 
Questionhow can i create public variable Pin
vipinpaliwal198019-Sep-06 2:22
vipinpaliwal198019-Sep-06 2:22 
AnswerRe: how can i create public variable Pin
S. Senthil Kumar19-Sep-06 2:29
S. Senthil Kumar19-Sep-06 2:29 
GeneralRe: how can i create public variable Pin
Ravi Bhavnani19-Sep-06 3:15
professionalRavi Bhavnani19-Sep-06 3:15 
GeneralRe: how can i create public variable Pin
S. Senthil Kumar19-Sep-06 4:11
S. Senthil Kumar19-Sep-06 4:11 
GeneralRe: how can i create public variable Pin
Ravi Bhavnani19-Sep-06 4:18
professionalRavi Bhavnani19-Sep-06 4:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.