StringGrid1中怎么设置文字自动居中啊
:
第二 StringGrid1.Cells[1,0]:='最'+#13+'大'+#13+'级'+#13+'数';这个回车也没用
:
第二 StringGrid1.Cells[1,0]:='最'+#13+'大'+#13+'级'+#13+'数';这个回车也没用
解决方案 »
- Delphi如何取得excel表格中某個格子里的函數
- 唉……一个COPYMEMORY,浪费一星期时间。
- 如何将字符串转成类实例
- ▲▲▲ 如何在窗口显示后定时显示一个消息,如时间在10:00显示一个消息???▲▲▲
- 编译时提示 Could not create output file <Filename>
- 一个关于safeArray的问题,很急,希望大家帮忙啊??
- GLSence载入纹理问题
- 处理实习阶段,可是遇到这样的问题,急呀
- 有没有倒班的同志?下在这个软件看看,有没有用。
- 数据库表名传递问题
- 请问如何安装GIFIMAGE这个控件呢?
- 关于TREEVIEW里任意节点的拖曳如何设置及编写代码!
ARow: Integer; Rect: TRect; State: TGridDrawState);
StringGrid1.Canvas.TextRect(rect,rect.Left,rect.Top,' '+str);
自己慢慢调整一下
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
{文字居中}
with Sender as TStringGrid do
begin
Canvas.FillRect(Rect);
if (ARow>0) and ((ACol>5) and (ACol<10)) then //数字右对齐
DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), Length(Cells[ACol, ARow]), Rect, DT_RIGHT or DT_SINGLELINE or DT_VCENTER)
else
DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), Length(Cells[ACol, ARow]), Rect, DT_CENTER or DT_SINGLELINE or DT_VCENTER);
end;
{文字居中结束}
end;
StringGrid1.Cells[1,0]:='最'+#13+'大'+#13+'级'+#13+'数'; 小弟写成这样但没有起到换行的作用,谢谢 谢谢,非常感谢各位
例子:showmessage('aa'+#13#10+'bb')
不行了,我试过.
各位仁兄,帮一帮啊
procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.Cells[1,0]:='最'+#13+'大'+#13+'级'+#13+'数';
ShowMessage(StringGrid1.Cells[1,0]);
end;如果你要在stringgrid中手写换行的话,用ctrl+回车就可以了放心大胆的用吧,代码该怎么写怎么写,没事的!呵呵
begin
StringGrid1.cells[1,0]:='最'+#13+'大'+#13+'级'+#13+'数';
end; 也就是要显示竖行的 "最大级别"
同时非常感谢各位,谢谢,期待能加几段原码就搞了。
另外,类似StringGrid1.cells[1,0]:='最'+#13+'大'+#13+'级'+#13+'数';这种初始化的东西最好写在form的OnShow事件里。