就象开始菜单中的“windows ......professional”的写法
解决方案 »
- 如何隐藏异常,让程序继续执行呢
- 横向打印问题
- 请教如果定制自己的ListView中的Item.
- char怎么转成ascii和int比大小啊
- 关于xml的一个问题,帮忙解决一下
- 紧急求助,高分报答
- copy函数
- 如何导出xml格式?
- 有关于Delphi开发局域网数据库系统的书籍或者资料吗?
- Delphi 5 的补丁需要注册码。。help me ~~~~~help me ~~~~~help me ~~~~~help me ~~~~~help me ~~~~~help me ~~~~~
- sql中的group by分组,分组是什么意思,什么情况下需要分组,目前我只知道分组是不显示重复数据
- 求教一段修改计时器处理程序的代码
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm_Main.Button7Click(Sender: TObject);
var exForm: TForm;
exImage: TImage;
StrList: TStringList;
var i, Edge, CharWidth, RowSpace: integer;
Rect: TRect;
TextFormat: UINT;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function MaxLength: integer;
var i: integer;
begin
Result := 0;
for i:=1 to StrList.Count do if Length(StrList.Strings[i-1])>Result then Result := Length(StrList.Strings[i-1]);
end;
begin
Edge := 5;
StrList := TStringList.Create;
StrList.Clear;
if MessageBox(Self.Handle,PChar('请选择显示信息类别!'),'提示!',MB_YESNO+MB_ICONQUESTION)=IDYes
then begin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TextFormat := DT_VCENTER;
StrList.Add('岱宗夫如何'); StrList.Add('齐鲁青未了'); StrList.Add('造化钟神秀'); StrList.Add('阴阳割昏晓');
StrList.Add('荡胸生层云'); StrList.Add('绝眦入归鸟'); StrList.Add('会当凌绝顶'); StrList.Add('一览众山小');
end
else begin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TextFormat := DT_TOP;
StrList.Add('念奴娇'); StrList.Add('赤壁怀古'); StrList.Add('大江东去'); StrList.Add('浪淘尽');
StrList.Add('千古风流人物'); StrList.Add('故垒西边'); StrList.Add('人道是'); StrList.Add('三国周郎赤壁');
StrList.Add('乱石穿空'); StrList.Add('惊涛拍岸'); StrList.Add('卷起千堆雪'); StrList.Add('江山如画');
StrList.Add('一时多少豪杰'); StrList.Add('遥想公谨当年'); StrList.Add('小乔初嫁了'); StrList.Add('雄姿英发');
StrList.Add('羽扇纶巾'); StrList.Add('谈笑间'); StrList.Add('强虏灰飞烟灭'); StrList.Add('故国神游');
StrList.Add('多情应笑我'); StrList.Add('早生华发'); StrList.Add('人生如梦'); StrList.Add('一樽还酹江月');
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Application.CreateForm(TForm, exForm);
try
RowSpace := 5;
CharWidth := Abs(exForm.Font.Height)+4;
exImage := TImage.Create(exForm);
exImage.Parent := exForm;
exImage.Height := MaxLength*Abs(exForm.Font.Height);
exImage.Width := (CharWidth+RowSpace)*(StrList.Count + 1);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rect := Bounds(Edge, Edge, exImage.Width-Edge*2, exImage.Height-Edge*2);
exImage.Canvas.Rectangle(Rect.Left,Rect.Top,Rect.Right,Rect.Bottom);
for i:=1 to StrList.Count do
begin
Rect := Bounds(exImage.Width-(CharWidth+RowSpace)*i-Edge*2, Edge+(exImage.Height-Edge*2-exImage.Canvas.TextWidth(StrList.Strings[i-1])) div 2, CharWidth, exImage.Height-Edge*2);
DrawText(exImage.Canvas.Handle,PChar(StrList.Strings[i-1]),Length(StrList.Strings[i-1]),Rect,DT_CENTER or TextFormat or DT_WORDBREAK);
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exForm.Position := poScreenCenter;
exForm.BorderStyle := bsDialog;
exForm.ClientWidth := exImage.Width;
exForm.ClientHeight := exImage.Height;
exForm.ShowModal;
finally
exForm.DestroyComponents;
exForm.Free;
end;
end;