如何在winform中右对齐数字类型列 [英] how to right align numeric type column in winform

查看:90
本文介绍了如何在winform中右对齐数字类型列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用VS2008进行Windows移动开发。我需要右对齐datagrid中的数字类型列。我有一个数据表绑定到数据网格使用



datagrid1.datasource = datatable



问题是如何我可以右对齐数据网格中的数字类型列。



任何帮助都会非常感激



谢谢



pete



i am doing an windows mobile development using VS2008. I need to right align the numeric type column in the datagrid. I have binding a datatable to the datagrid using

datagrid1.datasource= datatable

the problem is how can i right align the numeric type column in the datagrid.

any help would be really appreciated

thanks

pete

推荐答案

设置 DefaultCellStyle 相关专栏的类似内容;



Set the DefaultCellStyle of the relevant column to something like this;

DataGridViewCellStyle cellStyle = new DataGridViewCellStyle();
cellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
someColumn.DefaultCellStyle = cellStyle;





希望这会有所帮助,

Fredrik



Hope this helps,
Fredrik


这篇关于如何在winform中右对齐数字类型列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆