Delphiマンセー
■ このスレッドは過去ログ倉庫に格納されています
0472デフォルトの名無しさん
NGNGRect:TRect; //位置情報
obj :TControl;//コンポーネントへの参照
end;
type TSaveControls=record
FormRect:TRect;//フォームのサイズ
Saves :array of TSavePos1;
end;
function SaveControlPos(form:TWinControl):TSaveControls;
var i:Integer;
begin
Result.FormRect:=form.ClientRect;
SetLength(Result.Saves,form.ControlCount);
for i:=0 to form.ControlCount-1 do with Result.Saves[i] do begin
obj :=form.Controls[i]; Rect :=obj.BoundsRect ;
end;
end;
procedure SaveControlRePos(form:TWinControl;const datas:TSaveControls);
var i:Integer; var ax,ay:double;
begin
with datas.FormRect do begin
ax:= form.Width / ( Right -Left ) ; ay:= form.Height / ( Bottom-Top ) ;
end;
for i:=0 to form.ControlCount-1 do
with datas.Saves[i] do
if obj.Parent=form then begin
obj.Left :=round(ax* Rect.Left);
obj.Width :=round(ax*(Rect.Right-Rect.Left) );
obj.Top :=round(ax*(Rect.Top ));
obj.Height:=round(ax*(Rect.Bottom-Rect.Top));
end;
end;
■ このスレッドは過去ログ倉庫に格納されています