private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { if (pictureBox1.Image != null) { FlowLayoutPanel newPanel = new FlowLayoutPanel(); FlowLayoutPanel newPanel2 = new FlowLayoutPanel(); Label location = new Label(); TextBox noteTB = new TextBox(); Button delBtn = new Button(); noteTB.Size = new System.Drawing.Size(noteFlowLayoutPanel.Width - 50, 20); noteTB.Multiline = true; noteTB.TextChanged += new System.EventHandler(noteTB_TextChanged); location.Text = "( " + e.X.ToString() + "," + e.Y.ToString() + " )"; location.Margin = new System.Windows.Forms.Padding(0, 5, 0, 0); location.Size = new System.Drawing.Size(noteFlowLayoutPanel.Width - 73, 23); delBtn.Text = "X"; delBtn.FlatStyle = FlatStyle.Popup; delBtn.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); delBtn.ForeColor = Color.Red; delBtn.Margin = new System.Windows.Forms.Padding(0); delBtn.Padding = new System.Windows.Forms.Padding(0); delBtn.Size = new System.Drawing.Size(23, 23); delBtn.Click += new System.EventHandler(delBtn_Click); newPanel2.Size = new System.Drawing.Size(noteFlowLayoutPanel.Width - 50, 23); newPanel2.FlowDirection = FlowDirection.LeftToRight; newPanel2.Controls.Add(location); newPanel2.Controls.Add(delBtn); newPanel.AutoSize = true; newPanel.FlowDirection = FlowDirection.TopDown; newPanel.Padding = new System.Windows.Forms.Padding(5, 0, 5, 5); newPanel.Controls.Add(newPanel2); newPanel.Controls.Add(noteTB); newPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; noteFlowLayoutPanel.Controls.Add(newPanel); //MessageBox.Show(newPanel.Width.ToString()); DateTime date = DateTime.Now; tnOpen = new TagNote(); tnOpen.ID_TagNote = ("TN" + date.ToShortDateString() + "_" + date.ToLongTimeString()).Replace("/", "-").Replace(":", "-"); tnOpen.ID_DCupNote = dcnOpen.ID_DCupNote; tnOpen.LocationX = e.X; tnOpen.LocationY = e.Y; DDC.TagNotes.InsertOnSubmit(tnOpen); DDC.SubmitChanges(); delBtn.Name = tnOpen.ID_TagNote; noteTB.Name = tnOpen.ID_TagNote; } }
private void noteTB_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; tnOpen = (from tn in DDC.TagNotes where tn.ID_TagNote == tb.Name select tn).FirstOrDefault(); tnOpen.Notes_TN = tb.Text; DDC.SubmitChanges(); }
private void delBtn_Click(object sender, EventArgs e) { Button b = (Button)sender; tnOpen = (from tn in DDC.TagNotes where tn.ID_TagNote == b.Name select tn).FirstOrDefault(); DDC.TagNotes.DeleteOnSubmit(tnOpen); DDC.SubmitChanges(); UpdateNotesFLP(); }
partial void DeleteTagNote(TagNote instance);
partial void UpdateTagNote(TagNote instance);
partial void InsertTagNote(TagNote instance);
private void detach_TagNotes(TagNote entity) { this.SendPropertyChanging(); entity.DCupNote = null; }
private void attach_TagNotes(TagNote entity) { this.SendPropertyChanging(); entity.DCupNote = this; }