就象delphi里窗体设计的时候,点中一个控件,旁边出现八个小黑点,Memo没有画布属性,现在label我已经实现了,谢谢,在线等。
解决方案 »
- EfileError in module rtl60.bpl.A class named TraCodeModule already exists.
- 怎么控制delphi里的控件随窗口的大小而改变大小啊?
- 如何取局域网一计算机系统时间啊?如何取局域网一计算机系统时间啊?在线等!!
- 请问如何读取注册表中的默认键值
- 要实现这个功能:运行程序时,现在判断这个程序是否已经运行,是:就显示那个程序的窗口为当前窗口,没有就继续运行。
- 喜欢打“真侍魂”的朋友多不多?
- 请推荐一些好书或者网站用Delphi编写Com的。
- 关于程序的关闭
- 谁会用 QRTextFilter 控件呀??
- 怎样做压缩文件的程序(给68分)?
- Delphi中用ADO连接Sybase数据库的问题,高手请进。
- 高分求教,怎样将一个字符串转换成相对应的16进制码,16进制码以字符串行式输出
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
PaintBox1: TPaintBox;
procedure FormCreate(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
R: TRect;
bSel: Boolean;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
PaintBox1.Width := 120; PaintBox1.Height := 120;
R.Top := 10; R.Left := 10; R.Right := 110; R.Bottom := 110;
bSel := False;
end;procedure TForm1.PaintBox1Paint(Sender: TObject);
const
radii: Byte = 3;
begin
with PaintBox1.Canvas do
begin
Brush.Color := clWhite;
Ellipse(R);
if bSel then
begin
Brush.Color := clBlack;
Rectangle(R.Top - radii, (R.Left+R.Right) div 2 - radii, R.Top + radii, (R.Left+R.Right) div 2 + radii);
Rectangle(R.Bottom - radii, (R.Left+R.Right) div 2 - radii, R.Bottom + radii, (R.Left+R.Right) div 2 + radii);
Rectangle((R.Left+R.Right) div 2 - radii, R.Top - radii, (R.Left+R.Right) div 2 + radii, R.Top + radii);
Rectangle((R.Left+R.Right) div 2 - radii, R.Bottom - radii, (R.Left+R.Right) div 2 + radii, R.Bottom + radii);
end;
end;
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if bSel then
begin
bSel := False;
Invalidate;
end;
end;procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if PtInRegion(CreateEllipticRgnIndirect(R), X, Y) then
begin
if not bSel then
begin
bSel := True;
Invalidate;
end;
end
else if bSel then
begin
bSel := False;
Invalidate;
end
end;end.