我有一个c#datagrid对象,允许多项选择。在Windows XP中,它可以正常工作,但在Windows 7中,在将光标从网格中移出后,之前选定的行(使用ctrl或shift)会在一段时间后重置(取消选择)。在Windows XP中,不会发生这种情况,除非用户取消选择,否则始终选择所选行。
这是我的网格:
this.dgAlindiListesi.AllowUserToAddRows = false;
this.dgAlindiListesi.AllowUserToDeleteRows = false;
this.dgAlindiListesi.AllowUserToResizeRows = false;
this.dgAlindiListesi.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgAlindiListesi.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgAlindiListesi.BackgroundColor = System.Drawing.Color.White;
this.dgAlindiListesi.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
this.dgAlindiListesi.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgAlindiListesi.Location = new System.Drawing.Point(23, 269);
this.dgAlindiListesi.Name = "dgAlindiListesi";
this.dgAlindiListesi.ReadOnly = true;
this.dgAlindiListesi.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgAlindiListesi.Size = new System.Drawing.Size(830, 359);
this.dgAlindiListesi.TabIndex = 1;
我很感激任何建议。
提前谢谢
答案 0 :(得分:0)
你在“dgAlindiListesi.LostFocus”事件回调中有什么?也许失去的焦点在XP和Windows7之间有所不同