WinForm Control 控件控制

C#
Control内
 
        public delegate void SetExRichReciveHandel(string str);
        public void SetExRichRecive(string str)
        {
            if (this.exRichRecive.InvokeRequired)
            {
                SetExRichReciveHandel SPBH = new SetExRichReciveHandel(SetExRichRecive);
                this.exRichRecive.Invoke(SPBH, new object[] { str });
            }
            else
            {
                this.exRichRecive.AppendText(str + "\r\n");
            }
        }
 
WinForm 内
private void MessageText(string str, string qicquid)
        {
            foreach (System.Windows.Forms.Control ctrl in chatPanle1.Controls)
            {
                string C = ctrl.Parent.ToString();//控件类型  
                if (C.ToUpper().Trim() == "SSTOICQ.Control.ChatPanle".ToUpper().Trim())
                {
                    if (((ChatPanle)ctrl.Parent).Oicq.ToLower().Trim().Equals(qicquid.Trim().ToLower()))
                    {
                        //发送消息
                        ((ChatPanle)ctrl.Parent).SetExRichRecive(str);
                        break;
                    }
                }
            }
        }
posted @ 2009-05-22 11:52  起源  阅读(212)  评论(0)    收藏  举报