public void Send(AddFile file, bool isOne = true) { this.Send(isOne, HeadAddFile, file.getName(), System.Convert.ToString(file.getSize()), System.Convert.ToString(file.isPrivate), System.Convert.ToString(file.getTime())); }
public static Panel createFileMessage(AddFile message, int PanelWidth, downloadClick click, bool isMine) { var MesView = new MessageView(PanelWidth * 9 / 10); var image = new Button(); image.Text = ""; image.Width = MesView.ImageWidth; image.Height = MesView.ImageHeight; image.Top = MesView.ImageTop; image.Region = MesView.ImageRegion; image.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; image.BackgroundImage = View.getAvatar(message.getCreator().avatarNumber); if (!isMine) { image.Left = MesView.ImageLeft; } var fileName = new Label(); fileName.Text = message.getName() + "\nsize: " + Convert.ToString(message.getSize()) + "\n" + message.getNewName(); fileName.Font = new Font(fileName.Font.Name, 8.0f, FontStyle.Bold | FontStyle.Underline); fileName.ForeColor = Color.White; fileName.AutoSize = true; fileName.MaximumSize = new Size(PanelWidth * 7 / 10, 0); fileName.MinimumSize = new Size(MesView.TextWidth, MesView.TextHeight); fileName.Height = fileName.PreferredHeight; fileName.Width = fileName.PreferredWidth; fileName.Top = MesView.TextTop; fileName.Click += new EventHandler(click); fileName.Cursor = Cursors.Hand; if (!isMine) { fileName.Left = MesView.TextLeft + 2 * MesView.ImageLeft + MesView.ImageWidth; } else { fileName.Left = MesView.TextLeft; image.Left = MesView.ImageLeft + 2 * MesView.TextLeft + fileName.Width; } var name = new Label(); name.Text = message.getCreator().Name + "#" + message.getCreator().HostName; name.Width = MesView.NameWidth; name.Left = fileName.Left; name.Top = fileName.Height + MesView.TextTop + MesView.NameTop; name.Height = MesView.NameHeight; var date = new Label(); date.Text = message.getTime().ToString(); date.Width = MesView.DateWidth; date.Left = name.Left + name.Width + MesView.DateLeft; date.Top = name.Top; date.Height = name.Height; var fullMessage = new Panel(); fullMessage.Width = image.Width + fileName.Width + 2 * MesView.ImageLeft + 2 * MesView.TextLeft; fullMessage.Text = ""; fullMessage.Height = Math.Max(MesView.ImageHeight + 2 * MesView.ImageTop, fileName.Height + MesView.TextTop + MesView.NameTop + name.Height); fullMessage.BorderStyle = BorderStyle.None; fullMessage.BackColor = Color.LightBlue; fullMessage.Controls.Add(image); fullMessage.Controls.Add(fileName); fullMessage.Controls.Add(name); fullMessage.Controls.Add(date); if (!isMine) { fullMessage.Left = MesView.MessageLeft; } else { fullMessage.Left = PanelWidth - MesView.MessageLeft - fullMessage.Width; } System.Drawing.Drawing2D.GraphicsPath Mess_Path = new System.Drawing.Drawing2D.GraphicsPath(); int r = 30; Mess_Path.AddPie(0, 0, 2 * r, 2 * r, 180, 90); Mess_Path.AddPie(0, fullMessage.Height - 2 * r, 2 * r, 2 * r, 90, 90); Mess_Path.AddPie(fullMessage.Width - 2 * r, 0, 2 * r, 2 * r, 270, 90); Mess_Path.AddPie(fullMessage.Width - 2 * r, fullMessage.Height - 2 * r, 2 * r, 2 * r, 0, 90); Mess_Path.AddRectangle(new Rectangle(r, 0, fullMessage.Width - 2 * r, fullMessage.Height)); Mess_Path.AddRectangle(new Rectangle(0, r, r, fullMessage.Height - 2 * r)); Mess_Path.AddRectangle(new Rectangle(fullMessage.Width - r, r, r, fullMessage.Height - 2 * r)); fullMessage.Region = new Region(Mess_Path); fullMessage.Top = MesView.MessageTop; return(fullMessage); }