Click here to Skip to main content
15,926,290 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to deal with Mouse Events & custom events in a component? Pin
Anonymous23-Jul-05 18:35
Anonymous23-Jul-05 18:35 
GeneralRe: How to deal with Mouse Events & custom events in a component? Pin
Cheng Zhong24-Jul-05 2:36
Cheng Zhong24-Jul-05 2:36 
GeneralRe: How to deal with Mouse Events & custom events in a component? Pin
Anonymous24-Jul-05 7:12
Anonymous24-Jul-05 7:12 
GeneralUnhandled Exception Pin
Mingzhi_8623-Jul-05 2:59
Mingzhi_8623-Jul-05 2:59 
GeneralRe: Unhandled Exception Pin
EssOEss23-Jul-05 3:57
EssOEss23-Jul-05 3:57 
GeneralRe: Unhandled Exception Pin
Mingzhi_8623-Jul-05 17:46
Mingzhi_8623-Jul-05 17:46 
GeneralText in a listview column Pin
Haim Yulzari23-Jul-05 2:52
Haim Yulzari23-Jul-05 2:52 
GeneralRe: Text in a listview column Pin
Anonymous23-Jul-05 18:30
Anonymous23-Jul-05 18:30 
Try this

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

try
{
//
/// Check if no mouse button is down
//
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)
{
//
/// Get the subItem on which the mouse pointer is present
//
curSubItem = item.SubItems[subItemIndex];
if (curSubItem != null)
{
if (curSubItem.Text.Length > 0)
{
subItemTextWidth = this.ListViewGetStringWidth(curSubItem.Text);
if (subItemTextWidth != -1)
{
//
/// MSDN:: ListViewSubItem text is padded 6 pixels on both side of the Text
//
subItemTextWidth += LISTVIEWSUBITEM_STRING_PADDING;
if (subItemTextWidth > this.Columns[subItemIndex].Width)
{
if (curSubItem != this.lastSubItemHovered)
{
this.SetToolTipText(curSubItem.Text);
this.lastSubItemHovered = curSubItem;
}
}
else
{
this.SetToolTipText(string.Empty);
}
}//end subItemTextWidth
}//end curSubItem.Text
}//end curSubItem
}//end subItemIndex
}//end item
}//end e.Button
}
catch (Exception exception)
{
ExceptionDisplayer exceptionDisplayer = new ExceptionDisplayer(exception);
}
}


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

Live Life King Size
Alomgir Miah
GeneralRe: Text in a listview column Pin
Haim Yulzari24-Jul-05 1:49
Haim Yulzari24-Jul-05 1:49 
Generalsigning and strong names Pin
dirkhelmet!@yahoo.com23-Jul-05 2:13
dirkhelmet!@yahoo.com23-Jul-05 2:13 
GeneralRe: signing and strong names Pin
Rob Graham23-Jul-05 4:19
Rob Graham23-Jul-05 4:19 
GeneralWSA Cancell Blocking Call Socket Exception Pin
meetsukant23-Jul-05 1:55
meetsukant23-Jul-05 1:55 
Generalexpression evaluation Pin
khalouda23-Jul-05 0:07
khalouda23-Jul-05 0:07 
GeneralRe: expression evaluation Pin
S. Senthil Kumar23-Jul-05 0:35
S. Senthil Kumar23-Jul-05 0:35 
GeneralRe: expression evaluation Pin
khalouda23-Jul-05 3:13
khalouda23-Jul-05 3:13 
GeneralRe: expression evaluation Pin
Dario Solera24-Jul-05 10:55
Dario Solera24-Jul-05 10:55 
GeneralProblem in adding bool check column to datagrid. Pin
amrutajoshi22-Jul-05 23:13
amrutajoshi22-Jul-05 23:13 
GeneralRe: Problem in adding bool check column to datagrid. Pin
Srinivas Jonnalagadda23-Jul-05 7:55
Srinivas Jonnalagadda23-Jul-05 7:55 
GeneralRe: Problem in adding bool check column to datagrid. Pin
Wyxlwiis23-Jul-05 10:35
Wyxlwiis23-Jul-05 10:35 
GeneralMarshal.PtrToStructure gives gibberish Pin
EssOEss22-Jul-05 22:41
EssOEss22-Jul-05 22:41 
GeneralRe: Marshal.PtrToStructure gives gibberish Pin
EssOEss23-Jul-05 9:04
EssOEss23-Jul-05 9:04 
GeneralInfragistics tutorials Pin
dhol22-Jul-05 21:41
dhol22-Jul-05 21:41 
Generali think re-draw listview's VScrollBar Pin
yanzhengguang22-Jul-05 20:15
yanzhengguang22-Jul-05 20:15 
GeneralRe: i think re-draw listview's VScrollBar Pin
yanzhengguang22-Jul-05 20:18
yanzhengguang22-Jul-05 20:18 
GeneralRe: i think re-draw listview's VScrollBar Pin
yanzhengguang22-Jul-05 20:21
yanzhengguang22-Jul-05 20:21 

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.