No.1 procedure TForm1.BitBtn1Click(Sender: TObject); begin Image1.Picture := nil; end;
No.2 procedure TForm1.BitBtn1Click(Sender: TObject); var S: string; I: Integer; begin S := 'abc'; for I := 1 to Length(S) do Image1.Canvas.TextOut(0, (I - 1) * Image1.Canvas.TextHeight('|'), S[I]); end;
for I := 1 to Length(S) do begin Image1.Canvas.TextOut(0, (I - 1) * Image1.Canvas.TextHeight('¦'), S[I]); end;
这样是不是清楚点 for I := 1 to Length(S) do begin x:=0; y:=(i-1)*Image1.Canvas.TextHeight('|'); Image1.Canvas.TextOut(x,y, S[I]); end;
有没有什么好办法呀! 调api应该调什么呀!!
procedure TForm1.Button1Click(Sender: TObject); var S: WideString; I: Integer; begin S := '汉字也可以'; for I := 1 to Length(S) do Image1.Canvas.TextOut(0, (I - 1) * Image1.Canvas.TextHeight('|'), S[I]); end;
var S: WideString; I: Integer; begin S := '你在时时'; for I := 1 to Length(S) do Image1.Canvas.TextOut((I - 1) * Image1.Canvas.TextWidth('|'), (I - 1) * Image1.Canvas.TextHeight('|'), S[I]); end;
var S: WideString; I: Integer; begin S := '你在时时'; for I := 1 to Length(S) do Image1.Canvas.TextOut((I - 1) * Image1.Canvas.TextWidth('无'), (I - 1) * Image1.Canvas.TextHeight('吴'), S[I]); end;
procedure TForm1.Button1Click(Sender: TObject); var lf : TLogFont; tf : TFont; begin with Form1.Canvas do begin Font.Name := 'Arial'; Font.Size := 24; tf := TFont.Create; tf.Assign(Font); GetObject(tf.Handle, sizeof(lf), @lf); lf.lfEscapement := 450; lf.lfOrientation := 450; tf.Handle := CreateFontIndirect(lf); Font.Assign(tf); tf.Free; TextOut(20, Height div 2, 'Rotated Text!'); end; end; ================================== procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var LogFont : TLogFont; newFont : TFont; begin with Form1.Canvas do begin Font.Name := '黑体'; // 字体 Font.Size := 32; // 字号 Font.Color:= $00ffcc; // 颜色 // 创建新字体 newFont := TFont.Create; newFont.Assign(Font); // 新字体继承窗体字体的属性 // 为新字体设置旋转属性 GetObject(newFont.Handle, sizeof(LogFont), @LogFont); LogFont.lfEscapement :=600; //角度*10 LogFont.lfOrientation :=600; //应设为同样的值 LogFont.lfWidth:=20; //每个字符的大小 LogFont.lfHeight:=90; newFont.Handle := CreateFontIndirect(LogFont); Font.Assign(newFont); newFont.Free; // 在鼠标按下的位置显示文字 TextOut(X, Y, '旋转文字Demo'); end; end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Image1.Picture := nil;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
S: string;
I: Integer;
begin
S := 'abc';
for I := 1 to Length(S) do
Image1.Canvas.TextOut(0, (I - 1) * Image1.Canvas.TextHeight('|'), S[I]);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Image1.Canvas.FillRect(Rect(0, 0, Image1.Picture.Bitmap.Width - 1,
Image1.Picture.Bitmap.Height - 1));
end;
指定的Canvas当前字体的文字所占高度,像素数。
begin Image1.Canvas.TextOut(0, (I - 1) * Image1.Canvas.TextHeight('¦'), S[I]);
end;
for I := 1 to Length(S) do
begin
x:=0;
y:=(i-1)*Image1.Canvas.TextHeight('|');
Image1.Canvas.TextOut(x,y, S[I]);
end;
调api应该调什么呀!!
var
S: WideString;
I: Integer;
begin
S := '汉字也可以';
for I := 1 to Length(S) do
Image1.Canvas.TextOut(0, (I - 1) * Image1.Canvas.TextHeight('|'), S[I]);
end;
S: WideString;
I: Integer;
begin
S := '你在时时';
for I := 1 to Length(S) do
Image1.Canvas.TextOut((I - 1) * Image1.Canvas.TextWidth('|'), (I - 1) * Image1.Canvas.TextHeight('|'), S[I]);
end;
S: WideString;
I: Integer;
begin
S := '你在时时';
for I := 1 to Length(S) do
Image1.Canvas.TextOut((I - 1) * Image1.Canvas.TextWidth('无'), (I - 1) * Image1.Canvas.TextHeight('吴'), S[I]);
end;
var
lf : TLogFont;
tf : TFont;
begin
with Form1.Canvas do begin
Font.Name := 'Arial';
Font.Size := 24;
tf := TFont.Create;
tf.Assign(Font);
GetObject(tf.Handle, sizeof(lf), @lf);
lf.lfEscapement := 450;
lf.lfOrientation := 450;
tf.Handle := CreateFontIndirect(lf);
Font.Assign(tf);
tf.Free;
TextOut(20, Height div 2, 'Rotated Text!');
end;
end;
==================================
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
LogFont : TLogFont;
newFont : TFont;
begin
with Form1.Canvas do
begin
Font.Name := '黑体'; // 字体
Font.Size := 32; // 字号
Font.Color:= $00ffcc; // 颜色
// 创建新字体
newFont := TFont.Create;
newFont.Assign(Font); // 新字体继承窗体字体的属性
// 为新字体设置旋转属性
GetObject(newFont.Handle, sizeof(LogFont), @LogFont);
LogFont.lfEscapement :=600; //角度*10
LogFont.lfOrientation :=600; //应设为同样的值
LogFont.lfWidth:=20; //每个字符的大小
LogFont.lfHeight:=90;
newFont.Handle := CreateFontIndirect(LogFont);
Font.Assign(newFont);
newFont.Free;
// 在鼠标按下的位置显示文字
TextOut(X, Y, '旋转文字Demo');
end;
end;
//我要看看你的
procedure TForm1.Button1Click(Sender: TObject);
var
lf : TLogFont;
tf : TFont;
S: WideString;
I: Integer;
begin
with Image1.Canvas do begin
Font.Name := '宋体';
Font.Size := 24;
tf := TFont.Create;
tf.Assign(Font);
GetObject(tf.Handle, sizeof(lf), @lf);
lf.lfEscapement := 450;
lf.lfOrientation := 450;
tf.Handle := CreateFontIndirect(lf);
Font.Assign(tf);
tf.Free;
end;
S := '汉字也可以';
for I := 1 to Length(S) do
Image1.Canvas.TextOut(0, I * Image1.Canvas.TextHeight('|'), S[I]);
end;
var
S: WideString;
I: Integer;
begin
Image2.Canvas.FillRect(Rect(0, 0, Image2.Width, Image2.Height));
S := '汉字也可以';
for I := 1 to Length(S) do
Image2.Canvas.TextOut(0, I * Image2.Canvas.TextHeight('|'), S[I]);
Image2.Picture.Bitmap.TransParentColor := Image2.Canvas.Font.Color;
Image2.Transparent := True;
Image1.Canvas.Draw(1, 1, Image2.Picture.Bitmap);
end;procedure TForm1.FormCreate(Sender: TObject);
var
lf : TLogFont;
tf : TFont;
begin
//Image2//写字
//Image1//放图
with Image2.Canvas do begin
Font.Name := '宋体';
Font.Size := 24;
tf := TFont.Create;
tf.Assign(Font);
GetObject(tf.Handle, sizeof(lf), @lf);
lf.lfEscapement := 450;
lf.lfOrientation := 450;
tf.Handle := CreateFontIndirect(lf);
Font.Assign(tf);
tf.Free;
end;
end;
你没有明白我的意思,我想要Label的Transparent属性设为True后的样子
有没有新的答案