![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hi Patrik, I have spent more than one hour researching on the ButtonRenderer class and haven't found a way to draw a flat style button using the ButtonRenderer class. I have tried with VisualStyleElement and VisualStyleRenderer classes, but unfortunately, they don't help in solving this problem either. In fact, the DataGridViewButtonColumn class has provided a property named FlatStyle, which gets or sets the flat-style appearance of the button cells in the colum. We could set the value of FlatStyle property to Flat, so that each button cell in that column has a flat style look. If you'd like to draw your custom button cell with a flat style look, I suggest that you draw it by yourself. You only need to draw the border of the 'button'. The following is a sample. // comment out the below statement //ButtonRenderer.DrawButton(graphics, buttonArea, PushButtonState.Default); // use the following statements to draw the border of the button using (Pen p = new Pen(cellStyle.ForeColor)) { graphics.DrawRectangle(p, buttonArea.X, buttonArea.Y, buttonArea.Width - 1, buttonArea.Height - 1); } Hope this helps. If you have any question, please feel free to let me know. Sincerely, Linda Liu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |