一个用 Remoting写的C/S架构程序.
客户端程序有一个datagridview,在其中一个客户端改变其中一个cell的值和背景颜色,然后所有客户端显示的值也随之改变(这里暂且不讨论同步问题).
不知大家有没有明白我的意思。
客户端程序有一个datagridview,在其中一个客户端改变其中一个cell的值和背景颜色,然后所有客户端显示的值也随之改变(这里暂且不讨论同步问题).
不知大家有没有明白我的意思。
public class ServerRemote : MarshalByRefObject
{
private Dictionary<string, DataGridViewCellStyle> _CellStatus =
new Dictionary<string, DataGridViewCellStyle>(); //string 为 cell的内容,DataGridViewCellStyle里包含backcolor; public Dictionary<string, DataGridViewCellStyle> CellStatus
{
get { return _CellStatus; }
set { this._CellStatus = value; }
} public void UpdateCellStatus(string cellValue, DataGridViewCellStyle style)
{
if (_CellStatus[cellValue] == null)
{
_CellStatus.Add(cellValue, style);
}
else
{
_CellStatus[cellValue] = style;
}
} public override object InitializeLifetimeService()
{
return null;
}
}
然后客户端里有一个记时器timer1,使用CellPainting事件:private void CellDataGrid_CellPainting(object sender,
DataGridViewCellPaintingEventArgs e)
{
///太晚了,明天再想怎么办.
}