Esempio n. 1
0
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            int width, height;
            int pagePadding;
            int lineDistance;
            int fontSize;

            if (checkBoxUserDefined.Checked)
            {
                width  = (int)numericUpDownResolutionWidth.Value;
                height = (int)numericUpDownResolutionHeight.Value;
            }
            else
            {
                string   resolutionStr     = comboBoxPredefinedResolution.SelectedItem as string;
                int      leftBracketIndex  = resolutionStr.IndexOf('(');
                int      rightBracketIndex = resolutionStr.IndexOf(')');
                string   resStr            = resolutionStr.Substring(leftBracketIndex + 1, rightBracketIndex - leftBracketIndex - 1);
                string[] splits            = resStr.Split('x');
                width  = Convert.ToInt32(splits[0]);
                height = Convert.ToInt32(splits[1]);
            }
            pagePadding  = (int)numericUpDownPagePadding.Value;
            lineDistance = (int)numericUpDownLineDistance.Value;
            fontSize     = Convert.ToInt32(comboBoxFontSize.SelectedItem as string);
            Bitmap      img       = DrawImage(width, height, pagePadding, lineDistance, fontSize);
            FormPreview previewer = new FormPreview(img);

            previewer.ShowDialog();
        }
Esempio n. 2
0
 private void buttonPreview_Click(object sender, EventArgs e)
 {
     int width, height;
     int pagePadding;
     int lineDistance;
     int fontSize;
     if (checkBoxUserDefined.Checked)
     {
         width = (int)numericUpDownResolutionWidth.Value;
         height = (int)numericUpDownResolutionHeight.Value;
     }
     else
     {
         string resolutionStr = comboBoxPredefinedResolution.SelectedItem as string;
         int leftBracketIndex = resolutionStr.IndexOf('(');
         int rightBracketIndex = resolutionStr.IndexOf(')');
         string resStr = resolutionStr.Substring(leftBracketIndex + 1, rightBracketIndex - leftBracketIndex - 1);
         string[] splits = resStr.Split('x');
         width = Convert.ToInt32(splits[0]);
         height = Convert.ToInt32(splits[1]);
     }
     pagePadding = (int)numericUpDownPagePadding.Value;
     lineDistance = (int)numericUpDownLineDistance.Value;
     fontSize = Convert.ToInt32(comboBoxFontSize.SelectedItem as string);
     Bitmap img = DrawImage(width, height, pagePadding, lineDistance, fontSize);
     FormPreview previewer = new FormPreview(img);
     previewer.ShowDialog();
 }