下部の画面に大きく字を描きます。
---------------------------------
private void FormBallGame_Load(object sender, EventArgs e)
{
DrawCircleSelectPictureBox();
DrawmainPictureBox();
}
private void DrawCircleSelectPictureBox()
{
int height = selectPictureBox.Height;
int width = selectPictureBox.Width;
Bitmap selectCanvas = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(selectCanvas))
{
g.FillEllipse(Brushes.LightBlue, 0, 0, height, height);
selectPictureBox.Image = selectCanvas;
}
}
private void DrawmainPictureBox()
{
Bitmap canvas = new Bitmap(mainPictureBox.Width,
mainPictureBox.Height);
using(Graphics g = Graphics.FromImage(canvas))
{
g.DrawString("萩",
new Font("HG教科書体",
mainPictureBox.Height - mainPictureBox.Height / 4 ),
Brushes.Gray,0,0,new StringFormat());
mainPictureBox.Image = canvas;
}
}
-------------------------------------
文字のフォントをメイリオにするとはみ出ました。ちなみに、
mainPictureBox.Height - mainPictureBox.Height / 4 ←を3にするとうまく表示されます。
0 件のコメント:
コメントを投稿