Dxexpress 的GridControl控件中一次选择一行并且不显示单元格焦点的设置 (转自C#之旅)

在C#的DxGridControl控件中,通过消除可编辑标志,可以实现选择行时保持无单元格焦点状态,从而确保行的完整选择效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

折腾了好久,总是发现在gridView中一选择的话,选择一行是没有问题,但被点中的单元格却失去了高亮度显示的特征,此时发现行标记那里有一个指示可以编辑的符号,测试了一下,但把此可编辑符号搞掉以后,就能实现一次选择完整的一行.

一般这样设置就可以了.

private void InitializeComponent()
        
{
            
this.components = new System.ComponentModel.Container();
            
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
            
this.gridControl1 = new DevExpress.XtraGrid.GridControl();
            
this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
            ((System.ComponentModel.ISupportInitialize)(
this.bindingSource1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(
this.gridControl1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(
this.gridView1)).BeginInit();
            
this.SuspendLayout();
            
// 
            
// bindingSource1
            
// 
            this.bindingSource1.CurrentChanged += new System.EventHandler(this.bindingSource1_CurrentChanged_1);
            
// 
            
// gridControl1
            
// 
            this.gridControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            
// 
            
// 
            
// 
            this.gridControl1.EmbeddedNavigator.Name = "";
            
this.gridControl1.Location = new System.Drawing.Point(00);
            
this.gridControl1.MainView = this.gridView1;
            
this.gridControl1.Name = "gridControl1";
            
this.gridControl1.Size = new System.Drawing.Size(654526);
            
this.gridControl1.TabIndex = 0;
            
this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
            
this.gridView1}
);
            
// 
            
// gridView1
            
// 
           
            
// 
            this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            
this.gridView1.GridControl = this.gridControl1;
            
this.gridView1.Name = "gridView1";
            
this.gridView1.OptionsBehavior.Editable = false;
            
this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
            
            
// 

            
// 
            
// Form1
            
// 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            
this.ClientSize = new System.Drawing.Size(654526);
            
this.Controls.Add(this.gridControl1);
            
this.Name = "Form1";
            
this.Text = "Form1";
            
this.Load += new System.EventHandler(this.Form1_Load);
            ((System.ComponentModel.ISupportInitialize)(
this.bindingSource1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(
this.gridControl1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(
this.gridView1)).EndInit();
            
this.ResumeLayout(false);

        }
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值