enter image description here I want to align datagridview columns to right but I dont want to change width of column of my datagridview which I set. I've got eight columns second column's property "resizable" is set to true the rest is "resizable = "false. When I expand datagridview or window the width of columns except second should not expand. How to do it. Property Fill doesn't work like I want. I expadns all columns and gives them their own width. But I want to leave width of my columns as they're already set except of the second one.

推荐答案

两个步骤:

  1. 将DataGridView控件的AutoSizeColumnsMode设置为Fill.
  2. 将第二列的AutoSizeMode设置为None,将其他列保留为NotSet(默认值).

现在您应该看到,只有第二列的宽度是固定的,宽度被控制为Width,对于其他列,您可以更改FillWeight来控制宽度的比例.

Csharp相关问答推荐

无法更改或使用C#(WinForms.NET)中的全局变量

我应该将新的httpReportMessage()包装在using声明中吗?

C# uwp中的Win11启动屏幕剪辑工作方式不同

Serilog SQL服务器接收器使用UTC作为时间戳

如何在C#中删除一个特殊字符,如"使用Regex"

需要澄清C#的Clean Architecture解决方案模板的AuditableEntityInterceptor类

. NET JSON属性自定义所需逻辑

MudBlazor—MudDataGrid—默认过滤器定义不允许用户修改基本过滤器

如何在C#中使用Postman中的本地IP向本地主机上运行的本地API发出请求

用于管理System.Text.Json中的多态反序列化的自定义TypeInfoResolver

关于扩展文件类C#的矛盾

当我将`ConcurentDictionary`转换为`IDictionary`时,出现了奇怪的并发行为

{ or ; expected error如何解决此问题

C#Microsoft.CodeAnalysis.CSharp.Scriiting不等待并行.对于

使用可空引用类型时C#接口实现错误

在C#/ASP.NET Core 7中,什么可能导致POST请求作为GET请求发送

在C#和HttpClient中使用REST API

在C#中通过Matheval使用自定义公式

ASP.NET核心MVC|如何在控制器方法之间传递值

Unity 3D-意外轴捕捉和未知力对脉冲react 行为的影响