/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MessageForm)); this.label1 = new System.Windows.Forms.Label(); this.RecivedTextBox = new System.Windows.Forms.RichTextBox(); this.SendTextBox = new DGP_Messenger.ExRichTextBox(); this.flashTimer = new System.Windows.Forms.Timer(this.components); this.SendButtonImgs = new System.Windows.Forms.ImageList(this.components); this.btnSend = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.greyLine = new System.Windows.Forms.PictureBox(); this.btnPic = new System.Windows.Forms.Button(); this.EmotionImgs = new System.Windows.Forms.ImageList(this.components); this.btnFont = new System.Windows.Forms.Button(); this.FontDialog = new System.Windows.Forms.FontDialog(); this.KanterImgs = new System.Windows.Forms.ImageList(this.components); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.btnSendFile = new System.Windows.Forms.Button(); this.btnTransfers = new System.Windows.Forms.Button(); this.emotionPan = new System.Windows.Forms.Panel(); this.statusBar = new System.Windows.Forms.StatusBar(); this.statusBarPanel = new System.Windows.Forms.StatusBarPanel(); this.typingTimer = new System.Windows.Forms.Timer(this.components); this.clientWritingTimer = new System.Windows.Forms.Timer(this.components); this.roundedcornerPanel1 = new DGP_Messenger.RoundedcornerPanel(); this.roundedcornerPanel2 = new DGP_Messenger.RoundedcornerPanel(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.CausesValidation = false; this.label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label1.Location = new System.Drawing.Point(32, 64); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(424, 16); this.label1.TabIndex = 3; this.label1.Text = "Konversation Med "; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // RecivedTextBox // this.RecivedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.RecivedTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.RecivedTextBox.HideSelection = false; this.RecivedTextBox.Location = new System.Drawing.Point(32, 96); this.RecivedTextBox.Name = "RecivedTextBox"; this.RecivedTextBox.ReadOnly = true; this.RecivedTextBox.Size = new System.Drawing.Size(544, 280); this.RecivedTextBox.TabIndex = 3; this.RecivedTextBox.Text = ""; this.RecivedTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.This_LinkClicked); // // SendTextBox // this.SendTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.SendTextBox.BackColor = System.Drawing.Color.White; this.SendTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.SendTextBox.HiglightColor = DGP_Messenger.RtfColor.White; this.SendTextBox.Location = new System.Drawing.Point(32, 432); this.SendTextBox.MaxLength = 1024; this.SendTextBox.Name = "SendTextBox"; this.SendTextBox.Size = new System.Drawing.Size(448, 64); this.SendTextBox.TabIndex = 4; this.SendTextBox.Text = ""; this.SendTextBox.TextColor = DGP_Messenger.RtfColor.Black; this.SendTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SendTextBox_KeyDown); this.SendTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.SendTextBox_KeyPress); this.SendTextBox.TextChanged += new System.EventHandler(this.SendTextBox_TextChanged); this.SendTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.This_LinkClicked); // // flashTimer // this.flashTimer.Enabled = true; this.flashTimer.Interval = 6000; this.flashTimer.Tick += new System.EventHandler(this.flashTimer_Tick); // // SendButtonImgs // this.SendButtonImgs.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit; this.SendButtonImgs.ImageSize = new System.Drawing.Size(95, 72); this.SendButtonImgs.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("SendButtonImgs.ImageStream"))); this.SendButtonImgs.TransparentColor = System.Drawing.Color.Transparent; // // btnSend // this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnSend.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSend.Enabled = false; this.btnSend.Image = ((System.Drawing.Image)(resources.GetObject("btnSend.Image"))); this.btnSend.Location = new System.Drawing.Point(496, 424); this.btnSend.Name = "btnSend"; this.btnSend.Size = new System.Drawing.Size(95, 72); this.btnSend.TabIndex = 5; this.btnSend.TabStop = false; this.btnSend.Click += new System.EventHandler(this.btnSend_Click); this.btnSend.MouseEnter += new System.EventHandler(this.btnSend_MouseEnter); this.btnSend.MouseLeave += new System.EventHandler(this.btnSend_MouseLeave); // // pictureBox2 // this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.Dock = System.Windows.Forms.DockStyle.Top; this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(0, 0); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(600, 32); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox2.TabIndex = 7; this.pictureBox2.TabStop = false; // // greyLine // this.greyLine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.greyLine.BackColor = System.Drawing.Color.LightGray; this.greyLine.Location = new System.Drawing.Point(24, 80); this.greyLine.Name = "greyLine"; this.greyLine.Size = new System.Drawing.Size(552, 3); this.greyLine.TabIndex = 10; this.greyLine.TabStop = false; // // btnPic // this.btnPic.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnPic.Location = new System.Drawing.Point(24, 392); this.btnPic.Name = "btnPic"; this.btnPic.Size = new System.Drawing.Size(56, 24); this.btnPic.TabIndex = 11; this.btnPic.Text = "Bild"; this.btnPic.Click += new System.EventHandler(this.btnPic_Click); // // EmotionImgs // this.EmotionImgs.ImageSize = new System.Drawing.Size(19, 19); this.EmotionImgs.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("EmotionImgs.ImageStream"))); this.EmotionImgs.TransparentColor = System.Drawing.Color.Transparent; // // btnFont // this.btnFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnFont.Location = new System.Drawing.Point(88, 392); this.btnFont.Name = "btnFont"; this.btnFont.Size = new System.Drawing.Size(56, 24); this.btnFont.TabIndex = 12; this.btnFont.Text = "Font"; this.btnFont.Click += new System.EventHandler(this.btnFont_Click); // // FontDialog // this.FontDialog.FontMustExist = true; this.FontDialog.MaxSize = 20; this.FontDialog.MinSize = 8; this.FontDialog.ShowColor = true; // // KanterImgs // this.KanterImgs.ImageSize = new System.Drawing.Size(10, 10); this.KanterImgs.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("KanterImgs.ImageStream"))); this.KanterImgs.TransparentColor = System.Drawing.Color.White; // // openFileDialog // this.openFileDialog.Title = "Välj fil som du vill skicka"; // // saveFileDialog // this.saveFileDialog.OverwritePrompt = false; this.saveFileDialog.Title = "Spara filen"; // // btnSendFile // this.btnSendFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnSendFile.Location = new System.Drawing.Point(152, 392); this.btnSendFile.Name = "btnSendFile"; this.btnSendFile.Size = new System.Drawing.Size(72, 23); this.btnSendFile.TabIndex = 0; this.btnSendFile.Text = "Skicka Fil"; this.btnSendFile.Click += new System.EventHandler(this.sendFile_Click); // // btnTransfers // this.btnTransfers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnTransfers.Location = new System.Drawing.Point(232, 392); this.btnTransfers.Name = "btnTransfers"; this.btnTransfers.Size = new System.Drawing.Size(64, 23); this.btnTransfers.TabIndex = 22; this.btnTransfers.Text = "Transfers"; this.btnTransfers.Click += new System.EventHandler(this.btnTransfers_Click); // // emotionPan // this.emotionPan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.emotionPan.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192))); this.emotionPan.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.emotionPan.Cursor = System.Windows.Forms.Cursors.Hand; this.emotionPan.Location = new System.Drawing.Point(24, 424); this.emotionPan.Name = "emotionPan"; this.emotionPan.Size = new System.Drawing.Size(112, 40); this.emotionPan.TabIndex = 25; this.emotionPan.Visible = false; this.emotionPan.Click += new System.EventHandler(this.emotionPan_Click); this.emotionPan.VisibleChanged += new System.EventHandler(this.emotionPan_VisibleChanged); this.emotionPan.Paint += new System.Windows.Forms.PaintEventHandler(this.emotionPan_Paint); this.emotionPan.MouseMove += new System.Windows.Forms.MouseEventHandler(this.emotionPan_MouseMove); this.emotionPan.MouseLeave += new System.EventHandler(this.emotionPan_MouseLeave); // // statusBar // this.statusBar.Location = new System.Drawing.Point(0, 511); this.statusBar.Name = "statusBar"; this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.statusBarPanel}); this.statusBar.ShowPanels = true; this.statusBar.Size = new System.Drawing.Size(600, 22); this.statusBar.TabIndex = 27; // // statusBarPanel // this.statusBarPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents; this.statusBarPanel.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.None; this.statusBarPanel.Icon = ((System.Drawing.Icon)(resources.GetObject("statusBarPanel.Icon"))); this.statusBarPanel.Text = "Chat"; this.statusBarPanel.Width = 59; // // typingTimer // this.typingTimer.Interval = 5000; this.typingTimer.Tick += new System.EventHandler(this.typingTimer_Tick); // // clientWritingTimer // this.clientWritingTimer.Interval = 10000; this.clientWritingTimer.Tick += new System.EventHandler(this.clientWriting_Tick); // // roundedcornerPanel1 // this.roundedcornerPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.roundedcornerPanel1.BackColor = System.Drawing.Color.Transparent; this.roundedcornerPanel1.ForeColor = System.Drawing.Color.White; this.roundedcornerPanel1.Location = new System.Drawing.Point(24, 88); this.roundedcornerPanel1.Name = "roundedcornerPanel1"; this.roundedcornerPanel1.Size = new System.Drawing.Size(560, 296); this.roundedcornerPanel1.TabIndex = 28; // // roundedcornerPanel2 // this.roundedcornerPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.roundedcornerPanel2.BackColor = System.Drawing.Color.Transparent; this.roundedcornerPanel2.ForeColor = System.Drawing.Color.White; this.roundedcornerPanel2.Location = new System.Drawing.Point(24, 424); this.roundedcornerPanel2.Name = "roundedcornerPanel2"; this.roundedcornerPanel2.Size = new System.Drawing.Size(464, 80); this.roundedcornerPanel2.TabIndex = 29; // // MessageForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(246)), ((System.Byte)(246)), ((System.Byte)(247))); this.CausesValidation = false; this.ClientSize = new System.Drawing.Size(600, 533); this.Controls.Add(this.emotionPan); this.Controls.Add(this.statusBar); this.Controls.Add(this.SendTextBox); this.Controls.Add(this.RecivedTextBox); this.Controls.Add(this.btnTransfers); this.Controls.Add(this.label1); this.Controls.Add(this.greyLine); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.btnSendFile); this.Controls.Add(this.btnFont); this.Controls.Add(this.btnPic); this.Controls.Add(this.btnSend); this.Controls.Add(this.roundedcornerPanel1); this.Controls.Add(this.roundedcornerPanel2); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "MessageForm"; this.Text = "MessengerForm"; this.Closing += new System.ComponentModel.CancelEventHandler(this.MessageForm_Closing); this.Load += new System.EventHandler(this.MessageForm_Load); this.Activated += new System.EventHandler(this.MessageForm_Activated); this.Deactivate += new System.EventHandler(this.MessageForm_Deactivate); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel)).EndInit(); this.ResumeLayout(false); }
public void DisplayMessage(string message, Color color, string displayName, bool rtf, Font font) { int index = RecivedTextBox.Text.Length; if(displayName != "") { RecivedTextBox.Select(RecivedTextBox.Text.Length, 0); RecivedTextBox.SelectionIndent = 5; RecivedTextBox.SelectionColor = Color.Red; RecivedTextBox.SelectionFont = new Font("Verdana", SendTextBox.Font.Size); RecivedTextBox.AppendText(displayName); RecivedTextBox.SelectionColor = Color.FromArgb(46, 56, 84); RecivedTextBox.AppendText(" säger:\n"); } if(rtf == true) { ExRichTextBox rtfConv = new ExRichTextBox(); rtfConv.Rtf = message; rtfConv.SelectAll(); rtfConv.SelectionIndent = 20; if(rtfConv.SelectionFont != null) { rtfConv.SelectionFont = new Font(rtfConv.SelectionFont.FontFamily, SendTextBox.Font.Size, SendTextBox.Font.Style); } else { rtfConv.SelectionFont = new Font("Verdana", SendTextBox.Font.Size, SendTextBox.Font.Style); } RecivedTextBox.Select(RecivedTextBox.Text.Length, 0); RecivedTextBox.SelectedRtf = rtfConv.Rtf; } else { RecivedTextBox.SelectionIndent = 20; RecivedTextBox.SelectionColor = color; if(font != null) { RecivedTextBox.SelectionFont = font; } else { RecivedTextBox.SelectionFont = new Font("Verdana", TextFont.Size); } message = message.Replace('\r', ' '); message = message.Replace('\n', ' '); RecivedTextBox.AppendText(message.Trim() + "\n"); } //Check for smileys! int length = RecivedTextBox.Text.Length; //int index = RecivedTextBox.Text.Length - length; string compString; for(int stringIndex = index; stringIndex < length-1; stringIndex++) { //MessageBox.Show(RecivedTextBox.Text.Length + " - " + length.ToString() + " = " + index.ToString() + " ++" + stringIndex.ToString()); compString = RecivedTextBox.Text[stringIndex].ToString() + RecivedTextBox.Text[stringIndex+1].ToString(); for(int iconIndex = 0; iconIndex < antEmotions; iconIndex++) { if( compString.ToLower() == emotions[iconIndex].itsString) { RecivedTextBox.Select(stringIndex, 2); ExRichTextBox picToRich = new ExRichTextBox(); picToRich.InsertImage(EmotionImgs.Images[emotions[iconIndex].number]); RecivedTextBox.SelectedRtf = picToRich.Rtf; } } } if(this.Active == true) { RecivedTextBox.Focus(); RecivedTextBox.ScrollToCaret(); SendTextBox.Focus(); SendTextBox.Select(SendTextBox.TextLength, 0); } else { AlertMessage(); } }