我有一个DataGridView
有两种类型的单元格,不同的是背景色(红色/绿色)。
我想为这个DataGridView设置一个ContextMenu
,但我希望红色单元格和绿色单元格不同。有没有办法这样做?
作为第二个问题,有没有办法为ToolTip
分配DataGridViewCells
,并且再次与红色/绿色单元格不同?
答案 0 :(得分:0)
已解决,我注意到我不仅可以在DataGridView属性中添加ContextMenuStrip,而且当我使用foreach row
到达确切的单元格,然后在{{foreach
cell
时1}}并将ContextMenuStrip设置为确切的单元格。
答案 1 :(得分:0)
在网格视图中添加工具提示 -
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>