<Columns>
<asp:BoundColumn DataField="title" HeaderText="列标题">
</Columns>
<asp:BoundColumn DataField="title" HeaderText="列标题">
</Columns>
解决方案 »
- 编译器错误信息:bc30456:"initializeculture"不是"asp.default_as px"的成员。
- 请问下web应用程序如何部署成指向htpp:\\?
- 跨域ifreame子窗体调用父窗体 求解答,在线等!立马给分
- 传值问题
- 如何在IE右键点击时,在原右键菜单的基础上加入自己的功能菜单项(100分哦,能解决的另开贴加分)
- C#判断是否为FLOAT
- 新手招找导老师!送100分
- 望过来人指一条明路给小生
- dllimport的用法问题
- asp.net无法访问所请求的资源
- 怪事,net2003 在 c# 下面键入messagebox.show后面的(号后挂了,而vb,c++下面正常
- C# winform 中如何设定让DATAGRID不绑定数据,而只做录入用?
private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
int intRow =0;
int intCellHehight = dataGrid1.GetCellBounds(intRow, 0).Height + 1;
int intY = dataGrid1.GetCellBounds(intRow, 0).Top + 2;
e.Graphics.DrawString("行号", dataGrid1.Font, new SolidBrush(Color.Black), 5, intY-intCellHehight-1); //把"行号" 换成你的内容
CurrencyManager cm = (CurrencyManager) this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
while(intY < dataGrid1.Height - intCellHehight && intRow < cm.Count)
{
//get & draw the header text...
string text = string.Format("{0}", (intRow+1)); //把(intRow+1)换成你的内容
e.Graphics.DrawString(text, dataGrid1.Font, new SolidBrush(Color.Black), 12, intY);
intY += intCellHehight;
intRow++;
}
}
另外请问gshope(gshope) 固定列怎么加?
当行很多时,要用滚动条来滚动以便查看下面的记录,可发现下面的记录的行头没显示
是这样的吗?怎么解决
private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
int intRow =0;
int intCellHehight = dataGrid1.GetCellBounds(intRow, 0).Height + 1;
int intY = dataGrid1.GetCellBounds(intRow, 0).Top + 2;
int intY0=intY-intCellHehight-1;//**********加新语句
//e.Graphics.DrawString("行号", dataGrid1.Font, new SolidBrush(Color.Black), 5, intY-intCellHehight-1); //把"行号" 换成你的内容*********移到下面的环后面
CurrencyManager cm = (CurrencyManager) this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
while(intY < dataGrid1.Height - intCellHehight && intRow < cm.Count)
{
//get & draw the header text...
string text = string.Format("{0}", (intRow+1)); //把(intRow+1)换成你的内容
e.Graphics.DrawString(text, dataGrid1.Font, new SolidBrush(Color.Black), 12, intY);
intY += intCellHehight;
intRow++;
}
e.Graphics.DrawString("序号", dg.Font, new SolidBrush(Color.Black), 5, intY0); //***********移到此
}