开发者

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

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 col开发者_如何转开发umn = 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 ......

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


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.


i have not understood your question about oval shape, do you mean you want button to be in standart style in winforms? if so, change your FlatStyle into .Standart:

column.FlatStyle = FlatStyle.Standard;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜