-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
DataGridViewCellToolTipTextNeededEventHandler.xml
79 lines (67 loc) · 7.25 KB
/
DataGridViewCellToolTipTextNeededEventHandler.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<Type Name="DataGridViewCellToolTipTextNeededEventHandler" FullName="System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler">
<TypeSignature Language="C#" Value="public delegate void DataGridViewCellToolTipTextNeededEventHandler(object sender, DataGridViewCellToolTipTextNeededEventArgs e);" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed DataGridViewCellToolTipTextNeededEventHandler extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler" />
<TypeSignature Language="VB.NET" Value="Public Delegate Sub DataGridViewCellToolTipTextNeededEventHandler(sender As Object, e As DataGridViewCellToolTipTextNeededEventArgs)" />
<TypeSignature Language="F#" Value="type DataGridViewCellToolTipTextNeededEventHandler = delegate of obj * DataGridViewCellToolTipTextNeededEventArgs -> unit" />
<TypeSignature Language="C++ CLI" Value="public delegate void DataGridViewCellToolTipTextNeededEventHandler(System::Object ^ sender, DataGridViewCellToolTipTextNeededEventArgs ^ e);" />
<TypeSignature Language="C#" Value="public delegate void DataGridViewCellToolTipTextNeededEventHandler(object? sender, DataGridViewCellToolTipTextNeededEventArgs e);" FrameworkAlternate="windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Parameters>
<Parameter Name="sender" Type="System.Object">
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="e" Type="System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs" />
</Parameters>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Docs>
<param name="sender">The source of the event.</param>
<param name="e">A <see cref="T:System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs" /> that contains the event data.</param>
<summary>Represents the method that will handle the <see cref="E:System.Windows.Forms.DataGridView.CellToolTipTextNeeded" /> event of a <see cref="T:System.Windows.Forms.DataGridView" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.DataGridView.CellToolTipTextNeeded> event occurs only when the <xref:System.Windows.Forms.DataGridView> control <xref:System.Windows.Forms.DataGridView.DataSource%2A> property is set or its <xref:System.Windows.Forms.DataGridView.VirtualMode%2A> property is `true`.
When you handle the <xref:System.Windows.Forms.DataGridView.CellToolTipTextNeeded> event, the ToolTip text you specify in the handler is shown whenever the mouse pointer is over a cell and the control <xref:System.Windows.Forms.DataGridView.ShowCellToolTips%2A> property value is `true`. The <xref:System.Windows.Forms.DataGridView.CellToolTipTextNeeded> event is useful when you want to display ToolTips determined by the current state or value of a cell.
The <xref:System.Windows.Forms.DataGridView.CellToolTipTextNeeded> event also occurs whenever the value of the <xref:System.Windows.Forms.DataGridViewCell.ToolTipText%2A?displayProperty=nameWithType> property is retrieved, either programmatically or when the mouse pointer enters a cell.
You can use the <xref:System.Windows.Forms.DataGridViewCellEventArgs.ColumnIndex%2A?displayProperty=nameWithType> and <xref:System.Windows.Forms.DataGridViewCellEventArgs.RowIndex%2A> properties to determine the state or value of a cell, and use this information to set the <xref:System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs.ToolTipText%2A> property. This property is initialized with the value of the cell <xref:System.Windows.Forms.DataGridViewCell.ToolTipText%2A> property, which the event value overrides.
Handle the <xref:System.Windows.Forms.DataGridView.CellToolTipTextNeeded> event when working with large amounts of data to avoid the performance penalties of setting the cell <xref:System.Windows.Forms.DataGridViewCell.ToolTipText%2A> value for multiple cells. For more information, see [Best Practices for Scaling the Windows Forms DataGridView Control](/dotnet/desktop/winforms/controls/best-practices-for-scaling-the-windows-forms-datagridview-control).
For more information about how to handle events, see [Handling and Raising Events](/dotnet/standard/events/).
When you create a <xref:System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler> delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example uses ToolTips to display additional information about cell contents in the `ReportsTo` column.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp" id="Snippet30":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContextMenuStripNeeded/sharedrows.cs" id="Snippet30":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/VB/sharedrows.vb" id="Snippet30":::
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="E:System.Windows.Forms.DataGridView.CellToolTipTextNeeded" />
<altmember cref="P:System.Windows.Forms.DataGridView.DataSource" />
<altmember cref="P:System.Windows.Forms.DataGridView.VirtualMode" />
<altmember cref="P:System.Windows.Forms.DataGridView.ShowCellToolTips" />
<altmember cref="T:System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs" />
<altmember cref="P:System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs.ToolTipText" />
<altmember cref="P:System.Windows.Forms.DataGridViewCell.ToolTipText" />
<related type="Article" href="/dotnet/framework/winforms/controls/best-practices-for-scaling-the-windows-forms-datagridview-control">Best Practices for Scaling the Windows Forms DataGridView Control</related>
</Docs>
</Type>