如何做一個填字遊戲? |
尚未結案
|
tommylitang
一般會員 ![]() ![]() 發表:12 回覆:0 積分:2 註冊:2004-12-12 發送簡訊給我 |
|
qoo1234
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
//參考看看
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) PaintBox1: TPaintBox; Button1: TButton; procedure PaintBox1Paint(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.PaintBox1Paint(Sender: TObject); var L:integer; begin //框格 PaintBox1.Canvas.Rectangle(PaintBox1.Left, PaintBox1.Top, PaintBox1.Width, PaintBox1.Height ); For L:=1 to 15 do begin PaintBox1.Canvas.MoveTo (PaintBox1.Left, PaintBox1.Top (L*20)); PaintBox1.Canvas.LineTo (PaintBox1.Width (L*20), PaintBox1.Top (L*20)); PaintBox1.Canvas.MoveTo (PaintBox1.Left (L*20), PaintBox1.Top); PaintBox1.Canvas.LineTo (PaintBox1.Left (L*20), PaintBox1.Height (L*20)); end; //填入黑格子 PaintBox1.Canvas.Brush.Color:=clBlack; PaintBox1.Canvas.FloodFill(PaintBox1.Left 30,PaintBox1.Top 50,clBlack,fsBorder); PaintBox1.Canvas.FloodFill(PaintBox1.Left 50,PaintBox1.Top 50,clBlack,fsBorder); PaintBox1.Canvas.Brush.Color:=clBtnFace; end; //填文字 procedure TForm1.Button1Click(Sender: TObject); begin PaintBox1.Canvas.Font.Size:=14; PaintBox1.Canvas.Font.Style:=[fsBold]; PaintBox1.Canvas.TextOut(PaintBox1.Left 5,PaintBox1.Top 1,'A'); PaintBox1.Canvas.TextOut(PaintBox1.Left 5,PaintBox1.Top 21,'B'); PaintBox1.Canvas.TextOut(PaintBox1.Left 5,PaintBox1.Top 41,'C'); end; procedure TForm1.FormCreate(Sender: TObject); begin PaintBox1.Left:=8; PaintBox1.Top:=8; PaintBox1.Width:=329; PaintBox1.Height:=329; end; end. ![]() |
qoo1234
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |