Reputation: 17701
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 ......
Upvotes: 2
Views: 7208
Reputation: 4320
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.
Upvotes: 2
Reputation: 1535
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;
Upvotes: 0