Пример #1
0
        /*
         * 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);
                }
            }
        }
Пример #2
0
        public bool setPageLocationWatermarkFromConfig(string page_location, SerializableStringDictionary config_dict)
        {
            if (config_dict != null)
            {
                if (config_dict["watermark_type"] == "text")
                {
                    page_locations[page_location]            = new Text_Watermark(config_dict["text"]);
                    page_locations[page_location].font_name  = config_dict["font_name"];
                    page_locations[page_location].font_size  = Int32.Parse(config_dict["font_size"]);
                    page_locations[page_location].font_style = config_dict["font_style"];
                    if (config_dict["add_timestamp"] == "Yes")
                    {
                        page_locations[page_location].add_timestamp = true;
                    }
                    page_locations[page_location].page_location = page_location;
                }
                else if (config_dict["watermark_type"] == "image")
                {
                    page_locations[page_location] = new Image_Watermark(config_dict["image_location"]);
                    page_locations[page_location].page_location = page_location;
                }

                else if (config_dict["watermark_type"] == "page_number")
                {
                    bool show_total = false;
                    if (config_dict["show_total"] == "Yes")
                    {
                        show_total = true;
                    }
                    page_locations[page_location]               = new PageNumberer(config_dict["text"], show_total);
                    page_locations[page_location].font_name     = config_dict["font_name"];
                    page_locations[page_location].font_size     = Int32.Parse(config_dict["font_size"]);
                    page_locations[page_location].font_style    = config_dict["font_style"];
                    page_locations[page_location].page_location = page_location;
                }
            }
            return(true);
        }
Пример #3
0
        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);
            }
        }