示例#1
0
 private void label1_DoubleClick(object sender, EventArgs e)
 {
     Settings = new NameCreatorSettings {
         Font   = new Font("Impact", 18f, FontStyle.Regular),
         Corner = true
     };
 }
        public static Bitmap createImage(NameCreatorSettings fontData, string text)
        {
            int linebreak = text.IndexOf("\\n");

            if (linebreak > -1)
            {
                return(createImage(fontData,
                                   text.Substring(0, linebreak),
                                   text.Substring(linebreak + 2)));
            }

            Bitmap   b = new Bitmap(208, 56);
            Graphics g = Graphics.FromImage(b);

            g.FillRectangle(new SolidBrush(Color.Black), 0, 0, 208, 56);

            bool corner = fontData.Corner;
            int  x      = corner ? -4 : 104;
            int  y      = corner ? 62 : 28 - fontData.VerticalOffset;

            g.DrawString(text, fontData.Font, new SolidBrush(Color.White), x, y, new StringFormat()
            {
                Alignment     = corner ? StringAlignment.Near : StringAlignment.Center,
                LineAlignment = corner ? StringAlignment.Far : StringAlignment.Center,
            });
            return(b);
        }
 private void btnImpact_Click(object sender, EventArgs e)
 {
     Settings = new NameCreatorSettings {
         Font = new Font("Impact", 22.5f),
         VerticalOffset = -1,
     };
 }
 private void btnEdo_Click(object sender, EventArgs e)
 {
     Settings = new NameCreatorSettings {
         Font = new Font("Edo SZ", 22f, FontStyle.Bold),
         VerticalOffset = 2,
     };
 }
示例#5
0
 private void btnEdo_Click(object sender, EventArgs e)
 {
     Settings = new NameCreatorSettings {
         Font           = new Font("Edo SZ", 22f, FontStyle.Bold),
         VerticalOffset = 2,
     };
 }
示例#6
0
 private void btnImpact_Click(object sender, EventArgs e)
 {
     Settings = new NameCreatorSettings {
         Font           = new Font("Impact", 22.5f),
         VerticalOffset = -1,
     };
 }
示例#7
0
 public static NameCreatorSettings selectFont(NameCreatorSettings previous = null)
 {
     using (NameCreatorDialog d = new NameCreatorDialog()) {
         if (previous != null) d.Settings = previous;
         if (d.ShowDialog() == DialogResult.OK) {
             return d.Settings;
         } else {
             return null;
         }
     }
 }
示例#8
0
 public static Bitmap createImage(NameCreatorSettings fontData, string line1, string line2)
 {
     Bitmap b = new Bitmap(208, 56);
     Graphics g = Graphics.FromImage(b);
     g.FillRectangle(new SolidBrush(Color.Black), 0, 0, 208, 56);
     g.DrawString(line1, fontData.Font, new SolidBrush(Color.White), 104, 13 - fontData.VerticalOffset, new StringFormat() {
         Alignment = StringAlignment.Center,
         LineAlignment = StringAlignment.Center,
     });
     g.DrawString(line2, fontData.Font, new SolidBrush(Color.White), 104, 43 - fontData.VerticalOffset, new StringFormat() {
         Alignment = StringAlignment.Center,
         LineAlignment = StringAlignment.Center,
     });
     return b;
 }
 public static NameCreatorSettings selectFont(NameCreatorSettings previous = null)
 {
     using (NameCreatorDialog d = new NameCreatorDialog()) {
         if (previous != null)
         {
             d.Settings = previous;
         }
         if (d.ShowDialog() == DialogResult.OK)
         {
             return(d.Settings);
         }
         else
         {
             return(null);
         }
     }
 }
        public static Bitmap createImage(NameCreatorSettings fontData, string line1, string line2)
        {
            Bitmap   b = new Bitmap(208, 56);
            Graphics g = Graphics.FromImage(b);

            g.FillRectangle(new SolidBrush(Color.Black), 0, 0, 208, 56);
            g.DrawString(line1, fontData.Font, new SolidBrush(Color.White), 104, 13 - fontData.VerticalOffset, new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center,
            });
            g.DrawString(line2, fontData.Font, new SolidBrush(Color.White), 104, 43 - fontData.VerticalOffset, new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center,
            });
            return(b);
        }
示例#11
0
 private void btnCustom_Click(object sender, EventArgs e)
 {
     using (FontDialog d = new FontDialog()) {
         if (Settings != null && Settings.Font != null) {
             d.Font = Settings.Font;
         }
         try {
             DialogResult dr = d.ShowDialog();
             if (dr == DialogResult.OK) {
                 Settings = new NameCreatorSettings {
                     Font = d.Font,
                     VerticalOffset = (int)nudOffset.Value,
                 };
             }
         } catch (ArgumentException ex) {
             MessageBox.Show(ex.Message);
         }
     }
 }
示例#12
0
 private void btnCustom_Click(object sender, EventArgs e)
 {
     using (FontDialog d = new FontDialog()) {
         if (Settings != null && Settings.Font != null)
         {
             d.Font = Settings.Font;
         }
         try {
             DialogResult dr = d.ShowDialog();
             if (dr == DialogResult.OK)
             {
                 Settings = new NameCreatorSettings {
                     Font           = d.Font,
                     VerticalOffset = (int)nudOffset.Value,
                 };
             }
         } catch (ArgumentException ex) {
             MessageBox.Show(ex.Message);
         }
     }
 }
示例#13
0
        public static Bitmap createImage(NameCreatorSettings fontData, string text)
        {
            int linebreak = text.IndexOf("\\n");
            if (linebreak > -1) {
                return createImage(fontData,
                    text.Substring(0, linebreak),
                    text.Substring(linebreak + 2));
            }

            Bitmap b = new Bitmap(208, 56);
            Graphics g = Graphics.FromImage(b);
            g.FillRectangle(new SolidBrush(Color.Black), 0, 0, 208, 56);

            bool corner = fontData.Corner;
            int x = corner ? -4 : 104;
            int y = corner ? 62 : 28 - fontData.VerticalOffset;
            g.DrawString(text, fontData.Font, new SolidBrush(Color.White), x, y, new StringFormat() {
                Alignment = corner ? StringAlignment.Near : StringAlignment.Center,
                LineAlignment = corner ? StringAlignment.Far : StringAlignment.Center,
            });
            return b;
        }
示例#14
0
 private void btnClearFont_Click(object sender, EventArgs e)
 {
     Settings = null;
 }
示例#15
0
 private void label1_DoubleClick(object sender, EventArgs e)
 {
     Settings = new NameCreatorSettings {
         Font = new Font("Impact", 18f, FontStyle.Regular),
         Corner = true
     };
 }
示例#16
0
 public void changeFrontStnameFont()
 {
     fontSettings = NameCreator.selectFont(fontSettings) ?? fontSettings;
 }
示例#17
0
 private void btnClearFont_Click(object sender, EventArgs e)
 {
     Settings = null;
 }
示例#18
0
 public void changeFrontStnameFont()
 {
     fontSettings = NameCreator.selectFont(fontSettings) ?? fontSettings;
 }