代码搜索结果
找到约 85,229 项符合
Sender 的代码
画图.txt
复制Ctrl C 粘贴Ctrl V
1.建一个文件夹,用于放程序。
2.新建一个程序。
3.保存(用Save All)
4.向窗体上放一个按钮(Button)控件,把它的标题(文字,Caption属性)改为
画直线,双击它添加事件,并添加代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
// Canvas是画布
按钮事件.txt
从控件工具栏找到按钮控件,点一下,然后在窗体上点一下,
按钮就会放到窗体上
两个状态:编程状态与运行状态
编程状态按钮要按两下,生成一个函数表示按钮事件
运行状态按一下
编程状态-->运行状态:按上面工具栏的绿三角
运行状态-->编程状态:关闭运行程序窗口
改变标题:
在生成的函数中添加代码:
procedure TForm1.Button1Click(<mark>Sender</mark>: TObje ...
俄罗斯方块7.txt
增加暂停的功能
11.把暂停和继续两个按钮的功能合二为一,即修改为下面的代码
procedure TForm1.Button3Click(Sender: TObject);
begin
Timer1.Enabled:=not Timer1.Enabled;
if Timer1.Enabled then
Button3.Caption:='暂停'
else Bu
俄罗斯方块5.txt
增加向下运动的功能
9.向窗体添加一个定时器Timer1,并添加事件和代码
procedure TForm1.Timer1Timer(Sender: TObject);
begin
y:=y+20;
Repaint;
end;
unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
procedure FormPaint(Sender: T
俄罗斯方块6.txt
增加暂停的功能
10.向窗体添加一个按钮Button3,文字改为"暂停",并添加事件和代码
procedure TForm1.Button3Click(Sender: TObject);
begin
Timer1.Enabled:=False;
end;
俄罗斯方块11.txt
14.修改定时器Timer1的事件的代码,当方块到下面时把它放下来,并继续一个新的
procedure TForm1.Timer1Timer(Sender: TObject);
begin
y:=y+1;
//当一个方块到达下面要把它放下来,就是说要将
//方块所在的那些格子填满
if y=16 then
begin
Box[x,16]:=1;
俄罗斯方块3.txt
让图形能动,所以画图的坐标不能固定,就要定义坐标x,y
7.
var
Form1: TForm1;
x:Integer=20;
y:Integer=20;
前两行是原来的,在后面定义了两个变量x,y作为图形的坐标
更改原来的画图代码
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Brush.C
俄罗斯方块4.txt
刚才为图形运动做好了准备,现在只要改变x,y就可以让图形动了
8.添加一个按钮Button1,改变它的文字为'向右',并添加事件和代码
procedure TForm1.Button1Click(Sender: TObject);
begin
x:=x+20;
Repaint;
end;
同样添加'向左'的按钮Button2
俄罗斯方块2.txt
让画的图形不会被擦掉
6.去掉Button1的事件,换成窗体Form1的OnPaint(当窗体重画)事件
(选择窗体Form1,在左边工具栏翻到事件Events页,找到OnPaint事件,双击生成它)
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Brush.Color:=clRed;
Canvas.Rect