private void InsertText(BindingList <Storage.Text> insertText, Point coordinates) { int tempX = 0; int tempY = 0; foreach (Text textToAdd in insertText) { textToAdd.ZOrder = Zorder; Zorder += 1; textToAdd.Content = textToAdd.Content; textToAdd.Color = Color.Black; textToAdd.BackgroundColor = Color.Transparent; textToAdd.Location = new Point(coordinates.X + tempX, coordinates.Y + tempY); textToAdd.Font = new Font("Times New Roman", 12.0f); this.curText = textToAdd; //change the current text to the new object //increase text x and y coordinates so that they do not overlap tempX += 40; tempY += 40; this.doc.Add(curText); } optionsForm.DataBindingSource.DataSource = doc.content; this.optionsForm.RefreshItems(); this.docPictureBox.Invalidate(); }
private void docPictureBox_Click(object sender, EventArgs e) { MouseEventArgs me = (MouseEventArgs)e; Point coordinates = me.Location; if (doc.Find(coordinates) != null) //check to see if click is inside a text object { if (me.Button.ToString() == "Right") //checks to see if a right click { this.optionsForm.ShowDialog(); //opens options if right click on a text object if (this.optionsForm.closeAccept == true) { this.docPictureBox.Invalidate(); } return; } if (me.Button.ToString() == "Left") //checks to see if a right click { backToolStripStatusLabel.BackColor = this.curText.BackgroundColor; colorToolStripStatusLabel.BackColor = this.curText.Color; fontToolStripStatusLabel.Text = "Font: " + this.curText.Font.Name; } this.curText = doc.Find(coordinates);//change current text to the found object return; } InsertText("text", coordinates); }
private void docPictureBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; // If the event is not a left mouse click event, exit } downPoint = new Point(e.X, e.Y); this.curText = doc.Find(e.Location); statusToolStripStatusLabel.Text = "Text Selected"; }
private void InsertText(String insertText, Point coordinates) { Storage.Text curText = new Storage.Text(); curText.ZOrder = Zorder; Zorder += 1; curText.Content = insertText; curText.Color = Color.Black; curText.BackgroundColor = Color.Transparent; curText.Location = coordinates; curText.Font = new Font("Times New Roman", 12.0f); this.doc.Add(curText); optionsForm.DataBindingSource.DataSource = doc.content; this.optionsForm.RefreshItems(); this.docPictureBox.Invalidate(); this.curText = curText; //change the current text to the new object }
private void TopLevelForm_DragDrop(object sender, DragEventArgs e) { // Retrieve drag data string sourceText = (string)e.Data.GetData(typeof(string)); BindingList <Text> sourceTextObjects = doc.TurnIntoTextObjects(sourceText); DragEventArgs me = (DragEventArgs)e; Point coordinates = this.PointToClient(new Point(e.X, e.Y)); if (doc.Find(coordinates) != null) //check to see if click is inside a text object { backToolStripStatusLabel.BackColor = this.curText.BackgroundColor; colorToolStripStatusLabel.BackColor = this.curText.Color; fontToolStripStatusLabel.Text = "Font: " + this.curText.Font.Name; this.curText = doc.Find(coordinates);//change current text to the found object return; } InsertText(sourceTextObjects, coordinates); }