示例#1
0
        public NewDocumentDialog(InkControl control, KDocument doc, MainWindow window)
        {
            InitializeComponent();

            this.control = control;
            this.doc     = doc;
            this.window  = window;

            this.BackColor = Style.Default.MenuBackground;
            this.ForeColor = Style.Default.MenuForeground;
            this.Width     = 5 * Util.GetGUISize();
            this.Dock      = DockStyle.Left;

            formats = PageFormat.GetFormats();
            foreach (var f in formats)
            {
                cbPageFormat.Items.Add(f.Key);
            }
            foreach (ColorFilter filter in Enum.GetValues(typeof(ColorFilter)))
            {
                cbFilters.Items.Add(Language.GetText($"Newdoc.filter.{filter}"));
            }
            cbFilters.Text = Language.GetText($"Newdoc.filter.{ColorFilter.Normal}");

            if (formats.ContainsKey(Configuration.DefaultFormat))
            {
                cbPageFormat.Text = Configuration.DefaultFormat;
            }
            else
            {
                cbPageFormat.Text = cbPageFormat.Items[0].ToString();
            }

            Translator.Translate(this);
        }
示例#2
0
        public PageAdder(InkControl control, KDocument document)
        {
            InitializeComponent();

            isPosition      = new ItemSelector();
            isPosition.Dock = DockStyle.Top;
            Controls.Add(isPosition);
            isPosition.SendToBack();

            this.control  = control;
            this.document = document;
            this.Width    = 5 * Util.GetGUISize();
            this.Dock     = DockStyle.Left;

            comboBox1.Height   = Util.GetGUISize();
            comboBox1.Font     = new Font(comboBox1.Font.FontFamily, Util.GetGUISize() / 2, GraphicsUnit.Pixel);
            panelBottom.Height = Util.GetGUISize();
            btnAdd.Width       = 3 * Util.GetGUISize();
            isPosition.Height  = 3 * Util.GetGUISize();
            this.ClientSize    = new Size(8 * Util.GetGUISize(), 6 * Util.GetGUISize());
            var padding = this.Padding;

            padding.Top  = Util.GetGUISize() / 2;
            this.Padding = padding;

            this.BackColor        = Style.Default.MenuBackground;
            panelBottom.BackColor = Style.Default.MenuContrast;
            this.ForeColor        = Style.Default.MenuForeground;
            comboBox1.BackColor   = Style.Default.MenuContrast;
            comboBox1.ForeColor   = Style.Default.MenuForeground;
            isPosition.ForeColor  = Style.Default.MenuForeground;

            formats = PageFormat.GetFormats();
            foreach (var f in formats)
            {
                comboBox1.Items.Add(f.Key);
            }

            if (formats.ContainsKey(document.DefaultFormat))
            {
                comboBox1.Text = document.DefaultFormat;
            }
            else
            {
                comboBox1.Text = comboBox1.Items[0].ToString();
            }

            Dialogues.Translator.Translate(this);
            isPosition.Items = new string[] {
                Language.GetText("Newpage.beforeCurrent"),
                Language.GetText("Newpage.afterCurrent"),
                Language.GetText("Newpage.atEnd")
            };
            isPosition.SelectedIndex = 1;
        }
示例#3
0
        public Sizes()
        {
            InitializeComponent();

            foreach (var format in PageFormat.GetFormats())
            {
                ListViewItem itm = new ListViewItem(format.Key);
                itm.SubItems.Add("" + format.Value.Width + "mm");
                itm.SubItems.Add("" + format.Value.Height + "mm");
                listView1.Items.Add(itm);
            }
        }
示例#4
0
        void render(string selected)
        {
            PageFormat format = PageFormat.GetFormats()[selected];

            this.Format = format;
            SizeF    s   = format.GetPixelSize();
            Bitmap   bmp = new Bitmap((int)s.Width, (int)s.Height);
            Graphics g   = Graphics.FromImage(bmp);

            g.Clear(Color.White);
            SizeF sX = new SizeF(s.Width, original.Height / (float)original.Width * s.Width);
            SizeF sY = new SizeF(original.Width / (float)original.Height * s.Height, s.Width);
            SizeF sS = (sX.Width < sY.Width) ? sX : sY;

            g.DrawImage(original, (s.Width - sS.Width) / 2f, (s.Height - sS.Height) / 2f, sS.Width, sS.Height);
            EditetImage     = bmp;
            pbPreview.Image = bmp;
        }
示例#5
0
        public ImageImporter(Bitmap bmp)
        {
            InitializeComponent();
            original          = bmp;
            this.DialogResult = DialogResult.OK;

            foreach (var format in PageFormat.GetFormats())
            {
                cbFormats.Items.Add(format.Key);
            }

            if (cbFormats.Items.Count == 0)
            {
                this.Enabled = false;
            }
            else
            {
                string selected = cbFormats.Items[0].ToString();
                cbFormats.Text = selected;
                render(selected);
            }
        }