-
大小: 118KB文件类型: .rar金币: 2下载: 0 次发布日期: 2021-05-31
- 语言: C#
- 标签: C# Winform Devexpress GridControl Gridview
资源简介
在winform项目中,使用Devexpress GridControl控件,可能会遇到需要冻结头部几行的需求,本项目实例可以帮到你。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraVerticalGrid.Rows;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.base;
using System.Reflection;
using DevExpress.Data;
namespace WindowsApplication134 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e) {
//this.order_DetailsTableAdapter.Fill(this.nwindDataSet.Order_Details);
this.oldTopRowIndex = gridView1.TopRowIndex;
this.gridView1.OptionsView.RowAutoHeight = false;
//this.gridView1.OptionsView.ShowHorzLines = false;
//this.gridView1.OptionsView.ShowVertLines = false;
//this.gridView1.OptionsView.ColumnAutoWidth = false;
this.gridView1.OptionsView.ShowColumnHeaders = false;
this.gridView1.OptionsView.ShowGroupPanel = false;
this.gridView1.OptionsView.ShowIndicator = false;
this.gridView1.OptionsBehavior.Editable = false;
this.gridView1.OptionsSelection.EnableAppearanceFocusedRow = false;
this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
}
const int FixedRowCount = 1;
private void gridView1_CustomDrawCell(object sender DevExpress.XtraGrid.Views.base.RowCellCustomDrawEventArgs e) {
GridView view = sender as GridView;
if(e.RowHandle < 0) return;
Color foreColorForFixedCells = Color.Red;
int visibleIndex = view.GetVisibleIndex(e.RowHandle) - view.TopRowIndex;
if(visibleIndex >= 0 && visibleIndex < FixedRowCount) {
//if(e.Column.SummaryItem.SummaryType != SummaryItemType.None)
{
string displayText = e.Column.Name.ToString() + visibleIndex.ToString();
//displayText += “: “ + e.Column.SummaryItem.SummaryValue.ToString();
e.Graphics.DrawString(displayText e.Appearance.Font new SolidBrush(foreColorForFixedCells) e.Bounds);
}
e.Handled = true;
}
}
int oldTopRowIndex = 0;
private void gridView1_TopRowChanged(object sender EventArgs e) {
GridView view = sender as GridView;
int max = oldTopRowIndex > view.TopRowIndex ? oldTopRowIndex + FixedRowCount : view.TopRowIndex + FixedRowCount;
for(int i = view.TopRowIndex; i < max +1; i++)
view.RefreshRow(i);
}
bool IsFixedRow(int rowHandle GridView view) {
if(rowHandle >= view.TopRowIndex && rowHandle < view.TopRowIndex + FixedRowCount)
return true;
return false
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 387 2008-02-25 02:25 FixedRows\app.config
文件 37376 2012-09-24 11:02 FixedRows\bin\Debug\FixedRows.exe
文件 387 2008-02-25 02:25 FixedRows\bin\Debug\FixedRows.exe.config
文件 69120 2012-09-24 11:02 FixedRows\bin\Debug\FixedRows.pdb
文件 11608 2012-09-24 11:02 FixedRows\bin\Debug\FixedRows.vshost.exe
文件 387 2008-02-25 02:25 FixedRows\bin\Debug\FixedRows.vshost.exe.config
文件 931 2011-12-08 20:52 FixedRows\FixedRows.sln
..A..H. 26112 2012-09-24 11:02 FixedRows\FixedRows.suo
文件 4084 2012-09-24 11:02 FixedRows\Form1.cs
文件 6530 2012-09-24 10:53 FixedRows\Form1.Designer.cs
文件 6442 2012-09-24 10:53 FixedRows\Form1.resx
文件 69434 2011-12-08 20:52 FixedRows\nwindDataSet.Designer.cs
文件 3 2008-02-25 02:25 FixedRows\nwindDataSet.xsc
文件 16000 2008-02-25 02:25 FixedRows\nwindDataSet.xsd
文件 3 2008-02-25 02:25 FixedRows\nwindDataSet.xss
文件 0 2012-09-24 10:36 FixedRows\obj\Debug\build.force
文件 66840 2012-09-24 10:51 FixedRows\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6356 2012-09-24 11:02 FixedRows\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 37376 2012-09-24 11:02 FixedRows\obj\Debug\FixedRows.exe
文件 69120 2012-09-24 11:02 FixedRows\obj\Debug\FixedRows.pdb
文件 180 2012-09-24 10:52 FixedRows\obj\Debug\FixedRows.Properties.Resources.resources
文件 406 2012-09-24 10:54 FixedRows\obj\Debug\GenerateResource-ResGen.read.1.tlog
文件 610 2012-09-24 10:54 FixedRows\obj\Debug\GenerateResource-ResGen.write.1.tlog
文件 28672 2012-09-24 10:33 FixedRows\obj\Debug\TempPE\nwindDataSet.Designer.cs.dll
文件 5120 2012-09-24 10:33 FixedRows\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 1787 2012-09-24 11:02 FixedRows\obj\Debug\WindowsApplication134.csproj.FileListAbsolute.txt
文件 180 2012-09-24 10:54 FixedRows\obj\Debug\WindowsApplication134.Form1.resources
文件 473 2008-02-25 01:31 FixedRows\Program.cs
文件 1292 2008-02-25 01:31 FixedRows\Properties\AssemblyInfo.cs
文件 245 2012-09-24 11:02 FixedRows\Properties\licenses.licx
............此处省略25个文件信息
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- Winform可视化打印模板设计工具含源码
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论