public void ChangeSelected(object sender, EventArgs e) { if (this.isSelected) { foreach (Topic_Frame tf in Topic_Frames) { if (tf.isSelected) { tf.isSelected = false; tf.panel1.BackColor = Color.FromArgb(90, 90, 90); tf.label1.ForeColor = Color.FromArgb(150, 150, 150); tf.Topic_name.ForeColor = Color.FromArgb(150, 150, 150); } } Topic_Frame.InvokeNoOneSelected(sender, e); } else { foreach (Topic_Frame tf in Topic_Frames) { if (tf.isSelected) { tf.isSelected = false; tf.panel1.BackColor = Color.FromArgb(90, 90, 90); tf.label1.ForeColor = Color.FromArgb(150, 150, 150); tf.Topic_name.ForeColor = Color.FromArgb(150, 150, 150); } } Topic_Frame_Selected = this; this.isSelected = true; this.panel1.BackColor = Color.FromArgb(130, 130, 130); this.label1.ForeColor = Color.FromArgb(200, 200, 200); this.Topic_name.ForeColor = Color.FromArgb(200, 200, 200); } }
public void AddTopicFrame(Topic topic) { TopicChat topicChat = new TopicChat(); topicChat.Init(this._client, topic); this.topicChats.Add(topic.Topic_name, topicChat); Topic_Frame tf = new Topic_Frame(); tf.Dock = System.Windows.Forms.DockStyle.Top; tf.Topic = topic.Topic_name; tf.Selection += (sender, e) => { this.panelContent.SuspendLayout(); this.panelContent.Controls.Clear(); this.panelContent.Controls.Add(topicChat); this.Topic_State_Frame.buttonRemove_Init(this._client, this._client.Topics[topic.Topic_name]); this.panelContent.ResumeLayout(); }; this.panel_topic_list.Invoke(new MethodInvoker(delegate { this.panel_topic_list.Controls.Add(tf); })); topicFrames.Add(topic.Topic_name, tf); Topic_Frames.Add(tf); tf.Invoke(new MethodInvoker(delegate { tf.BringToFront(); })); }