// Events private void הודעהחדשהToolStripMenuItem_Click(object sender, EventArgs e) { this.ChangeMessage(sender, e); Point pntNewMsgLocation = this.MoveAllRight(this.nNewMsgClickLeft); ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, ""); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntNewMsgLocation.Y; cbiNewMsg.Left = pntNewMsgLocation.X; if (this.nMostLeftMsg > pntNewMsgLocation.X) { this.nMostLeftMsg = pntNewMsgLocation.X; } this.scrollArrows1.AddMessage(); // Focusing on new message if (pntNewMsgLocation.X > (3 * (this.nMsgWidth + this.nMsgsDistance))) { this.MoveAllLeft(-1 * (this.Controls.Count - 2) * (this.nMsgWidth + this.nMsgsDistance)); } else { this.scrollArrows1.MoveLeft(); } cbiNewMsg.Focus(); }
private void תמונהToolStripMenuItem_Click(object sender, EventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { this.ChangeMessage(sender, e); if (this.openFileDialog1.FileNames[0].StartsWith("\\\\")) { foreach (string strWebFile in this.openFileDialog1.FileNames) { Point pntNewMsgLocation = this.MoveAllRight(this.nNewMsgClickLeft); string strTemp = Path.GetTempFileName(); this.wclFileClient.DownloadFile(strWebFile, strTemp); this.memImage = new MemoryStream((File.ReadAllBytes(strTemp))); Image imgNewImage = Image.FromStream(this.memImage); File.Delete(strTemp); ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, imgNewImage); (cbiNewMsg.Controls[0] as PictureBox).DoubleClick += new EventHandler(cbiNewMsg_DoubleClick); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntNewMsgLocation.Y; cbiNewMsg.Left = pntNewMsgLocation.X; if (this.nMostLeftMsg > pntNewMsgLocation.X) { this.nMostLeftMsg = pntNewMsgLocation.X; } // Focusing on new message if (pntNewMsgLocation.X > (3 * (this.nMsgWidth + this.nMsgsDistance))) { this.MoveAllLeft(-1 * (this.Controls.Count - 2) * (this.nMsgWidth + this.nMsgsDistance)); } else { this.scrollArrows1.MoveLeft(); } this.scrollArrows1.AddMessage(); cbiNewMsg.Focus(); } } else { foreach (string strFileName in this.openFileDialog1.FileNames) { Point pntNewMsgLocation = this.MoveAllRight(this.nNewMsgClickLeft); this.memImage = new MemoryStream((File.ReadAllBytes(strFileName))); Image imgNewImage = Image.FromStream(this.memImage); ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, imgNewImage); (cbiNewMsg.Controls[0] as PictureBox).DoubleClick += new EventHandler(cbiNewMsg_DoubleClick); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntNewMsgLocation.Y; cbiNewMsg.Left = pntNewMsgLocation.X; if (this.nMostLeftMsg > pntNewMsgLocation.X) { this.nMostLeftMsg = pntNewMsgLocation.X; } // Focusing on new message if (pntNewMsgLocation.X > (3 * (this.nMsgWidth + this.nMsgsDistance))) { this.MoveAllLeft(-1 * (this.Controls.Count - 2) * (this.nMsgWidth + this.nMsgsDistance)); } else { this.scrollArrows1.MoveLeft(); } this.scrollArrows1.AddMessage(); cbiNewMsg.Focus(); } } } }