希望根据图片的尺寸绘出窗体,窗体略大于图片,窗体应画在那里?在wingdow窗体的中心?
解决方案 »
- 谁可以帮我打开这个文件
- 我想 TChart 纵坐标原点固定从 "0" 开始要如何做呢?
- 如何在 listbox中每行中添加图标
- Filter不能使用>号的问题,续贴!加分!
- 我被ADO难倒了
- 4月份到了南京,有南京的朋友吗?
- 非常简单的题目,谁都会,快来吧 来者有分
- 第一次操作报表可以正常显示,,进行另一次选择操作的时候,就没有数据显示出来了,怎么回事?在线等待!!!!急
- 我一运行<极品飞车>,程序中的一个线程就自动中断,为什么?
- 怎样把一个excel里的表导入到Access数据库里去?用程序实现
- 送分小问题~
- delphi2007用FastReport4.0制作报表,其中控件TfrxUserDataSet和数据库该怎么关联起来呢?通过什么属性?
简单的话用autosize+image实现,复杂的话自己创建窗体并设置大小,没什么难的啊
至于画在哪,这个你自己随意啊,不过是调整窗体的位置而已
你不明白问题。当一个窗体超过屏幕以后,就无法再通过设置form1.Width来改变大小了。比如你设置form1.width:=9999肯定是无效的。所以,当一个图片很大的时候,虽然image.autosize:=true,但由于窗体不能继续增大,所以就无法全部显示图片。也就是说image.autosize:=true无效。这才是问题的关键,如果按照你的说法,我想楼主不会问这么低级的问题。下面是解决代码:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
Image1: TImage;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Procedure WMGetMinMaxInfo(Var msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.WMGetMinMaxInfo(var msg: TWMGetMinMaxInfo);
begin
inherited;
With msg.MinMaxInfo^.ptMaxTrackSize Do Begin
X :=100000; //允许最宽值
Y :=100000; //允许最高值
End;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
close
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
image1.Picture.LoadFromFile(OpenDialog1.FileName);
SetBounds(0,0,Image1.Picture.Width,Image1.Picture.Height+100);
Image1.Left:=0;
Image1.Top:=0;
end;
end;end.