大家好:
   首先谢谢大家刚才的解答。我明白了一半可能是我刚才没有说清楚吧!
我的意思是这样的:我是说使窗体上的一个控件,例如“memo1”控件,我想让
“memo1”控件的大小和位置在窗体的大小改变时,与窗体大小相比“memo1”无论在大小还是在位置上都与设计是成比例的变化。请问在什么事件中利用窗体或控件的什么属性来写代码。请各位老大给出一个具体的例子好吗?因为我是个新手。
     谢谢大家了!我正急切的盼望着你们解答。

解决方案 »

  1.   

    var
      Form1: TForm1;
      LastHeight:integer;
      LastWidth:integer;implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    begin
     LastHeight:=Height;
     LastWidth:=Width;
    end;procedure TForm1.FormResize(Sender: TObject);
    begin
        scaleby(Height,LastHeight);  //函数
        LastHeight:=Height;
        LastWidth:=Width;
    end;
      

  2.   

    memo1.anchors:=[akLeft,akTop,akRight,akBottom];
      

  3.   

    the content of Delphi Online Help  ;Specifies how the control is anchored to its parent.property Anchors: TAnchors;DescriptionUse Anchors to ensure that a control maintains its current position relative to an edge of its parent, even if the parent is resized. When its parent is resized, the control holds its position relative to the edges to which it is anchored.If a control is anchored to opposite edges of its parent, the control stretches when its parent is resized. For example, if a control has its Anchors property set to [akLeft,akRight], the control stretches when the width of its parent changes.Anchors is enforced only when the parent is resized. Thus, for example, if a control is anchored to opposite edges of a form at design time and the form is created in a maximized state, the control is not stretched because the form is not resized after the control is created.Note: If a control should maintain contact with three edges of its parent (hugging one side of the parent and stretching the length of that side), use the Align property instead. Unlike Anchors, Align allows controls to adjust to changes in the size of other aligned sibling controls as well as changes to the parent抯 size.Specifies how a control is anchored to its parent.UnitControlstype TAnchors = set of TAnchorKind;
    type TAnchorKind = (akTop, akLeft, akRight, akBottom);DescriptionTAnchors is a set of TAnchorKind values. TAnchorKind can have one or more of the following values:Value MeaningakTop The control抯 position is fixed with respect to the top edge of its parent.
    akLeft The control抯 position is fixed with respect to the left edge of its parent.
    akRight The control抯 position is fixed with respect to the right edge of its parent.
    akBottom The control抯 position is fixed with respect to the bottom edge of its parent.
      

  4.   

    anchors:=[akLeft,akTop,akRight,akBottom];