public void InitializeChats(TblMember member) { button_chat = new Button[member.c_ids.Length]; picture_chat = new PictureBox[member.c_ids.Length]; const int x = -2; int y = richtxtChat.Location.Y; for (int i = 0; i < member.c_ids.Length; i++) { button_chat[i] = new Button(); button_chat[i].Location = new Point(x, y); button_chat[i].Name = "btnChat_" + i.ToString(); button_chat[i].Text = DBHandlerLiron.GetInstance().GetChatName(member.MemberId, member.c_ids[i]); button_chat[i].Size = new Size(btnAddChat.Size.Width, 43); button_chat[i].Font = new Font("Arial Narrow", 16); button_chat[i].Padding = new Padding(0); button_chat[i].Click += new EventHandler(button_click); if (member.chats[i].Receiver.Length > 1) { SizeButtonFont(button_chat[i]); } Controls.Add(button_chat[i]); if (member.chats[i].Receiver.Length == 1) { picture_chat[i] = new PictureBox(); picture_chat[i].Name = "pPic_" + i.ToString(); if (member.chats[i].Receiver.Length == 1) { picture_chat[i].Image = DBHandlerLiron.GetInstance().GetProfilePathWithMember(Member.chats[i].Receiver[0]); } picture_chat[i].BringToFront(); picture_chat[i].Location = new Point(x + 5, y + 7); picture_chat[i].SizeMode = PictureBoxSizeMode.StretchImage; picture_chat[i].Size = new Size(30, 30); picture_chat[i].Visible = true; Controls.Add(picture_chat[i]); button_chat[i].SendToBack(); } y += 43; } btnAddChat.Location = new Point(x, y); btnAddChat.SendToBack(); }
public App(int id) { Member = new TblMember(id); InitializeComponent(); }