用Tbitmap调入一幅图片时,如果图片较大时。Tbitmap的width和height较小时它只能显示图片的局部。咋样使图片充满(stretch)Tbitmap?
解决方案 »
- 如何获取在资源浏览器上拖曳放开鼠标时IDataObject将要存放的路径
- 庆祝网站上线,散分喽!!!人人有份!!
- 一个关于QUERY字段名赋值的问题,请教各位大虾
- 请大家都来讨论一下开发“环保程序”的心得和经验。 来者有分...
- 救我,用TMediaPlayer控件录音的问题
- 我要可有分!那位好人就捐点可用分吧!我的可有分快没了,我回答很多问题可我的可用分总是不增加呀!
- 在DBGird中怎样禁止‘向下’键
- 请看看,这问题出在那里?关于intraweb服务器问题~~~~·
- 最近一不小心,发现自己水平越来越低。。请大家讨论,如何提高自己。。。
- QREPORT 不能支持EPSON印表机吗?
- SOS!! 请各位大侠解决filter问题,答对立即给分,在线!!
- 请问如何取得field中字段类别,并将其显示出来?
============================================================================
The following example is taken from the custom draw demo. It shows how the OnCustomDraw event handler draws the background for the tree view before the items and lines are drawn.procedure TCustomDrawForm.TVCustomDraw(Sender: TCustomTreeView; const ARect: TRect; var DefaultDraw: Boolean);
begin
//This event should be used to draw any background colors or images.
//ARect represents the entire client area of the TreeView.
//Use the TreeView's canvas to do the drawing.
//Note that drawing a background bitmap is not really supported by CustomDraw,
//so scrolling can get messy. Best to subclass the TreeView and handle scrolling//messages.
with TV.Canvas do
begin
if None1.Checked then //no picture
begin
Brush.Color := BkgColorDialog.Color;
Brush.Style := FBrushStyle;
FillRect(ARect);
end else
if Tile1.Checked then //tile bitmap
begin
Brush.Bitmap := Image1.Picture.Bitmap;
FillRect(ARect);
end else //Stretch across the canvas. StretchDraw(ARect, Image1.Picture.Bitmap);
end;
DefaultDraw := FDefaultDraw;
//setting DefaultDraw to false here prevents all calls to OnCustomDrawItem.
end;
==============================================================================
摘自Delphi 7 Help
BitMap1.Stretch:=True;
Bitmap.Stretch:=True;
再用你的BitMap.Canvas.StretchDraw方法,将刚才的Bitmap的内容画上去就可以了吧。