我有一个DataGridView
与两种类型的细胞,不同的背景颜色(红色/绿色)。我想为这个DataGridView设置一个ContextMenu
,但我希望它对红色细胞和绿色细胞是不同的。有办法做到吗?
作为第二个问题,是否有一种方法为DataGridViewCells
分配ToolTip
,并且再次与红/绿细胞不同?
解决后,我注意到我不仅可以在DataGridView属性中添加ContextMenuStrip,而且当我使用foreach row
到达确切的单元格时,然后在row
中使用foreach
cell
并将ContextMenuStrip设置为确切的单元格。
在网格视图中添加工具提示-
asp:TemplateField HeaderText="Comments" SortExpression="short_comment">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("short_comment") %>' ToolTip ='<%# Bind("longer_comment") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>