*/ --------------------------------------------------------------------------------------
*/ 出自: http://hi.baidu.com/xiaoxichun http://hi.csdn.net/xiaochun1413
*/ 作者: simon
*/ 时间: 2008-12-16
*/ 声明: 尊重作者劳动,转载请保留本段文字
*/ --------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace bitmap字模
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public enum DataMode { hanzi, zimu }
public enum geshisize { 十六, 二十四, 三十二, 四十八 };
private int[] hanzishuzu = { 32, 72, 128, 288 };
private int[] hanzisize = { 16, 24, 32, 48 };
public geshisize geshi
{
get
{
if (radioButton_16.Checked) return geshisize.十六;
else if (radioButton_24.Checked) return geshisize.二十四;
else if (radioButton_32.Checked) return geshisize.三十二;
else return geshisize.四十八;
}
}
public Bitmap GetCharBMP(string str, int size)
{
StringFormat sf = new StringFormat(); // 设置格式
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Near;
Bitmap bmp = new Bitmap(size, size); // 新建位图变量
Graphics g = Graphics.FromImage(bmp);
g.DrawString(str, new Font("宋体", size * 3 / 4), Brushes.Black, new Rectangle(0, 0, size, size), sf); // 向图像变量输出字符
return bmp;
}