如何将按钮的大小减小到datagrid视图按钮列的小单元格,同时更改其他列单元格宽度 [英] how to decrese the size of button to a small size inside cell of datagrid view button column with out changing other column cells width
问题描述
我该怎么做这个......这是我的按钮列代码的代码....
DataGridViewButtonColumn column = new DataGridViewButtonColumn();
daatgridview1.Columns.Add(column);
column.Resizable = DataGridViewTriState.True;
column.FlatStyle = FlatStyle.Popup;
column.DefaultCellStyle.BackColor = Color.Green;
column.Text =Buy;
column.HeaderText =Buy;
column.UseColumnTextForButtonValue = true;
column.Name =btnbuy;
任何一个人都可以帮助这个......
将列样式' Padding
属性设置为适合的填充。它将增加按钮和网格网格线之间的距离。
获取或设置DataGridViewCell的边缘与其内容之间的距离。 - http://msdn.microsoft.com /de-de/library/system.windows.forms.datagridviewcellstyle.padding.aspx
确保将样式设置在正确的图层上你不要单独为每个单元格设置。
Hi i have data gridview button column its displaying button fine .... but it occupies entire cell in every row like below figure .. buy is the column name ...... i want to resize the button to oval shape ......
how can i do this......and this is my code for button column code....
DataGridViewButtonColumn column = new DataGridViewButtonColumn();
daatgridview1.Columns.Add(column);
column.Resizable = DataGridViewTriState.True;
column.FlatStyle = FlatStyle.Popup;
column.DefaultCellStyle.BackColor = Color.Green;
column.Text = "Buy";
column.HeaderText = "Buy";
column.UseColumnTextForButtonValue = true;
column.Name = "btnbuy";
would any one pls help on this one ......
Set the column style´d Padding
property to a padding that fits. It will increase the distance between your button and the grid´s grid lines.
"Gets or sets the space between the edge of a DataGridViewCell and its content." -- http://msdn.microsoft.com/de-de/library/system.windows.forms.datagridviewcellstyle.padding.aspx
Be sure to set the style on the correct "layer" so you don´t end up setting this for each cell individually.
这篇关于如何将按钮的大小减小到datagrid视图按钮列的小单元格,同时更改其他列单元格宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!