一个用 Remoting写的C/S架构程序.
客户端程序有一个datagridview,在其中一个客户端改变其中一个cell的值和背景颜色,然后所有客户端显示的值也随之改变(这里暂且不讨论同步问题).
不知大家有没有明白我的意思。

解决方案 »

  1.   

    这样做应该能做到,设置的时候把背景的颜色值存入数据库,客户端定时的读取数据库的值并动态刷新datagridview,不过这样会影响到性能,为啥会有这样的需求呢
      

  2.   

    保存之前客户端的设置结果,后面的cell都采用这种设置。
      

  3.   

    我就是想用datagridview来显示即时信息,所有不考虑建个数据库来存储。其实之前我使用的是tablelayoutpanel控件,然后用CellPaint事件。虽然能达到预期的效果,但是闪屏太厉害了,后来不得不放弃了。我就是想在远程对象ServerRemote里建一个字典,用来存储客户端的状态:    [Serializable]
        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)
            {
                ///太晚了,明天再想怎么办.
            }
             
      

  4.   

    我想其实最主要的问题还是怎样遍历datagridview中的cell,以及cell的内容(string)和Backcolor....