/* * Watermarking Tab Events */ private void edit_watermarker(object sender, EventArgs e) { Control box = (Control)sender; Button button = (Button)sender; string page_location = box.Name.Split('_')[1]; Label label = this.Controls.Find("label_" + page_location, true).FirstOrDefault() as Label; if (label.Text == "") { watermarkContextMenu.Show(button, new Point(0, button.Height)); } else { SerializableStringDictionary related_config = Configurator.GetConfigSerializableStringDict(page_location); if (label.Text == "Text") { Form wm = new Text_Watermark(page_location, related_config); wm.ShowDialog(this); } else if (label.Text == "Page Number") { Form wm = new Page_Number_Watermark(page_location, related_config); wm.ShowDialog(this); } else if (label.Text == "Image") { Form wm = new Image_Watermark(page_location, related_config); wm.ShowDialog(this); } } }
private void watermarkContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripItem m = (ToolStripItem)e.ClickedItem; ContextMenuStrip cm = (ContextMenuStrip)m.Owner; Control c = cm.SourceControl; string page_location = c.Name.Split('_')[1]; if (e.ClickedItem.Text == "Text") { Form wm = new Text_Watermark(page_location); wm.ShowDialog(this); } else if (e.ClickedItem.Text == "Page Number") { Form wm = new Page_Number_Watermark(page_location); wm.ShowDialog(this); } else if (e.ClickedItem.Text == "Image") { Form wm = new Image_Watermark(page_location); wm.ShowDialog(this); } }