|
serveru
serveru |
http://www.vipcn.com/SoftDown.asp?ID=10117
http://downloads.cnblogs.com/dottext/CNBlogsDottext10Beta2.rar
http://download.microsoft.com/download/b/b/7/bb7764ec-4f3e-48dc-b711-e1b3a200199e/EnterpriseLibraryJune2005.exe
http://www.itelite.com/download/hiForums050413.rar
http://www.microsoft.com/downloads/info.aspx?na=46&p=4&SrcDisplayLang=zh-cn&SrcCategoryId=&SrcFamilyId=8e2dfc8d-c20e-4446-99a9-b7f0213f8bc5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f9%2fb%2ff%2f9bff6646-2cdb-4069-ada0-548be9cb9338%2fSQL2000.AS-KB884525-SP4-x86-CHS.EXE
http://download.microsoft.com/download/7/b/f/7bf0ecf6-ab30-456a-a891-24e8dd7bab4a/SQL2000-KB899761-v8.00.2040-x86x64-CHS.exe
http://www.microsoft.com/downloads/info.aspx?na=46&p=6&SrcDisplayLang=zh-cn&SrcCategoryId=&SrcFamilyId=8e2dfc8d-c20e-4446-99a9-b7f0213f8bc5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f9%2fb%2ff%2f9bff6646-2cdb-4069-ada0-548be9cb9338%2fSQL2000-KB884525-SP4-x86-CHS.EXE
http://www.lm8.cn/SoftDown.asp?ID=19456
http://www.softsea.net/download.php?id=135411
我的程序框架大概是这样的:
代码省略了很多
private void Form1_Load(object sender, System.EventArgs e)

{
//这里初始化Form1里的dataGrid1,风格是系统默认的。
dataGrid1.DataSource = dt;
while(i<numCols)
{
DataGridTextBoxColumn tbc = new DataGridTextBoxColumn();
ts.GridColumnStyles.Add(tbc);
}
dataGrid1.TableStyles.Add(ts);
}窗体里有个button1,它的事件是
private void button1_Click(object sender, System.EventArgs e)

{
//DataGridCellColorTextBoxColumn继承于DataGridTextBoxColumn,重写了Paint事件,另外它还加入了一个新的方法PaintCol,这个方法为了能重画单个单元格,代码在下面
DataGridCellColorTextBoxColumn columnTextColumn ;
for(int i = 0; i < numCols; ++i)
{
columnTextColumn = new DataGridCellColorTextBoxColumn();
columnTextColumn.CheckCellColor += new
tableStyle.GridColumnStyles.Add(columnTextColumn);
}
dataGrid1.TableStyles.Add(tableStyle);
dataGrid1.DataSource = ds.Tables["Quote"];
}
public void PaintCol(Graphics g, Rectangle cellRect, CurrencyManager cm, int rowNum, 
{
this.Paint(g, cellRect, cm, rowNum, bBrush, fBrush, isVisible);
}
窗体里有个button2,它的事件是
private void button2_Click(object sender, System.EventArgs e)

{
//通过调用DataGridCellColorTextBoxColumn里的PaintCol方法重画七行七列的单元格的外观
DataGridCellColorTextBoxColumn tbc =
(DataGridCellColorTextBoxColumn)dgt.GridColumnStyles[7];
Graphics g = dataGrid1.CreateGraphics();
Rectangle cellRect;
cellRect=dataGrid1.GetCellBounds(7,7);
CurrencyManager cm =
(CurrencyManager)dataGrid1.BindingContext[ds.Tablesdgt.MappingName]];
Brush fBrush = new System.Drawing.SolidBrush(Color.Red);
Brush bBrush= new System.Drawing.SolidBrush(Color.Black);
tbc.PaintCol(g, cellRect, cm, 7, bBrush, fBrush, false );
}
运行时先点button1,再点button2,则button2重画的单元格的风格会在窗体最小化和最
大化后变回button1执行后产生的风格。我现在的问题是就是怎样才能把button2产生的
风格一直保留下来?
谢谢
另外在实际应用过程中不是只通过button触发事件更改单元格的外观的
有可能根据某个事件来随时更改指定单元格的外观
还有谁能说说当窗口最小化后再最大化时 发生了什么事情?