Click here to Skip to main content
15,867,990 members
Home / Discussions / C#
   

C#

 
QuestionJob Scheduler Pin
mohitTheOne25-Aug-05 9:46
mohitTheOne25-Aug-05 9:46 
AnswerRe: Job Scheduler Pin
miah alom25-Aug-05 11:45
miah alom25-Aug-05 11:45 
QuestionSubclassing in .NET Pin
Luis Alonso Ramos25-Aug-05 9:43
Luis Alonso Ramos25-Aug-05 9:43 
AnswerRe: Subclassing in .NET Pin
Daniel Turini25-Aug-05 10:31
Daniel Turini25-Aug-05 10:31 
GeneralRe: Subclassing in .NET Pin
Luis Alonso Ramos25-Aug-05 16:59
Luis Alonso Ramos25-Aug-05 16:59 
Answer[Message Deleted] Pin
miah alom25-Aug-05 11:59
miah alom25-Aug-05 11:59 
QuestionSetting the exact position of a tooltip Pin
Luis Alonso Ramos25-Aug-05 9:37
Luis Alonso Ramos25-Aug-05 9:37 
AnswerRe: Setting the exact position of a tooltip Pin
miah alom25-Aug-05 12:00
miah alom25-Aug-05 12:00 
I guess this is all you need. Give me a candy if this works for you.

private void ListControlMouseMove(object sender, MouseEventArgs e)
{
Point ptOnlist = Point.Empty;
ListViewItem item = null;
int subItemIndex = -1;
int subItemTextWidth = -1;
ListViewItem.ListViewSubItem curSubItem = null;

if (e.Button == MouseButtons.None)
{
item = this.GetItemAt(e.X, e.Y);
if (item != null)
{
subItemIndex = this.GetSubItemIndexFromPoint(item, new Point(e.X, e.Y));
if (subItemIndex != -1)
{
curSubItem = item.SubItems[subItemIndex];
if (curSubItem != null)
{
if (curSubItem.Text.Length > 0)
{
subItemTextWidth = this.ListViewGetStringWidth(curSubItem.Text);
if (subItemTextWidth != -1)
{
subItemTextWidth += 12;
if (subItemTextWidth > this.Columns[subItemIndex].Width)
{
this.SetToolTipText(curSubItem.Text);
}
else
{
this.HideToolTip();
}
}
}
}
}
else
{
this.HideDynamicControls();
}
}
}
}


protected int GetSubItemIndexFromPoint(ListViewItem item, Point ptInList)
{
int sumOfWidths = 0;
int columnIndex = 0;

foreach (ColumnHeader column in this.Columns)
{
if (sumOfWidths < ptInList.X && ptInList.X < sumOfWidths + column.Width)
{
return columnIndex;
}
sumOfWidths += column.Width;
columnIndex++;
}
return -1;
}

private const int LVM_GETSTRINGWIDTHW = 4183
protected int ListViewGetStringWidth(string subItemText)
{
IntPtr hString = Marshal.StringToHGlobalAuto(subItemText);
int width = UnsafeNativeMethods.SendMessage(this.Handle, LVM_GETSTRINGWIDTHW, 0, hString);
Marshal.FreeHGlobal(hString);

return width;
}

protected void SetToolTipText(string toolTipText)
{
if (toolTipText != null)
{
this.toolTip.Active = true;
this.toolTip.SetToolTip(this, toolTipText);
}
}

Cheers.
GeneralRe: Setting the exact position of a tooltip Pin
Luis Alonso Ramos25-Aug-05 16:47
Luis Alonso Ramos25-Aug-05 16:47 
GeneralRe: Setting the exact position of a tooltip Pin
miah alom26-Aug-05 11:03
miah alom26-Aug-05 11:03 
GeneralRe: Setting the exact position of a tooltip Pin
Luis Alonso Ramos26-Aug-05 16:31
Luis Alonso Ramos26-Aug-05 16:31 
GeneralRe: Setting the exact position of a tooltip Pin
Alomgir Miah26-Aug-05 17:31
Alomgir Miah26-Aug-05 17:31 
GeneralRe: Setting the exact position of a tooltip Pin
Luis Alonso Ramos26-Aug-05 22:08
Luis Alonso Ramos26-Aug-05 22:08 
QuestionPlease could you... Pin
KORCARI25-Aug-05 9:26
KORCARI25-Aug-05 9:26 
AnswerRe: Please could you... Pin
miah alom25-Aug-05 12:03
miah alom25-Aug-05 12:03 
GeneralRe: Please could you... Pin
radic.feng26-Aug-05 1:44
radic.feng26-Aug-05 1:44 
QuestionRegex vs. String - *Speed* Pin
User 665825-Aug-05 8:30
User 665825-Aug-05 8:30 
AnswerRe: Regex vs. String - *Speed* Pin
Daniel Turini25-Aug-05 9:04
Daniel Turini25-Aug-05 9:04 
GeneralRe: Regex vs. String - *Speed* Pin
User 665825-Aug-05 9:50
User 665825-Aug-05 9:50 
GeneralRe: Regex vs. String - *Speed* Pin
Daniel Turini25-Aug-05 10:37
Daniel Turini25-Aug-05 10:37 
GeneralRe: Regex vs. String - *Speed* Pin
User 665825-Aug-05 12:03
User 665825-Aug-05 12:03 
AnswerRe: Regex vs. String - *Speed* Pin
eggie526-Aug-05 7:19
eggie526-Aug-05 7:19 
GeneralRe: Regex vs. String - *Speed* Pin
User 665827-Aug-05 0:33
User 665827-Aug-05 0:33 
QuestionWindows Service Pin
Taurian11025-Aug-05 8:26
Taurian11025-Aug-05 8:26 
QuestionHow to Secure the Configuration Settings Pin
oneworld200225-Aug-05 7:25
oneworld200225-Aug-05 7:25 

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.