用于WinForms的teleerik UI免费下载30天试用版

GridViewImageColumn

GridViewImageColumn显示只读的数据库列的图像图像数据类型(OLE容器或BLOB)。

RadGridView尝试将包含未指定二进制数据的数据列转换为图像。

一些数据库如Access使用OLE镜像容器。RadGridView自动识别并跳过添加的标题。

支持的图像格式为图像类。net框架。

WinForms RadGridView GridViewImageColumn

创建GridViewImageColumn

GridViewImageColumn = new GridViewImageColumn();imageColumn。Name = "ImageColumn";imageColumn。字段名= "Photo"; imageColumn.HeaderText = "Picture"; imageColumn.ImageLayout = ImageLayout.Zoom; radGridView1.MasterTemplate.Columns.Insert(4, imageColumn);
Dim imageColumn作为新的GridViewImageColumn imageColumn。Name = "ImageColumn" ImageColumnFieldName = "Photo" imageColumn。HeaderText = "图片"ImageLayout = ImageLayout。变焦RadGridView1.MasterTemplate.Columns.Add(imageColumn)

如果GridViewImageColumn映射到来自DataBoundItem通过指定的字段名(在绑定模式下使用),单元格值将自动填充。对于未绑定模式,可以向单元格添加Image值,如下面的代码片段所示:

向单元格添加图像值

gridviewview1 . rows . addnew ();row.Cells(“ImageColumn”)。Value = Properties.Resources.TV_car;row = this. radgridview . rows . addnew ();row.Cells(“ImageColumn”)。Value = Image.FromFile(@"…\…\logo.png");
作为gridviewview1 . rows . addnew () row. cells ("ImageColumn")。Value = My.Resources。TV_car1 row = me . radgridview . rows . addnew () row. cells ("ImageColumn")。Value = Image.FromFile("…\…\logo.png")

图片布局

GridViewImageColumn控件控制大小的方法也实现了调整大小的功能ImageLayout财产。ImageLayout可以设置为以下任意一种:没有一个瓷砖中心拉伸变焦

设置图像布局

  • 没有:图像位于单元格的左上角。这个值可以与ImageAlignment属性的值结合使用,以指定图像在单元格中的位置:
imageColumn。ImageLayout= ImageLayout.None; imageColumn.ImageAlignment = ContentAlignment.BottomRight;
imageColumn。ImageLayout= ImageLayout.None imageColumn.ImageAlignment = ContentAlignment.BottomRight
  • 瓷砖:图像是重复的。

  • 中心:无论ImageAlignment值如何,图像都将定位在单元格中心。

  • 延伸:图像在单元中被拉伸。

  • 缩放:图像被放大,但长宽比被保留。

另请参阅

在本文中
Baidu
map