Вверх ↑
Ответов: 5227
Рейтинг: 587
#1: 2022-01-14 17:00:34 ЛС | профиль | цитата
nesco писал(а):
Так откуда ты его вызываешь?



      WM_SIZE: begin
                 SetAnchors;
                 //Control.Update;
               end;
...

procedure THIWin._onResize;
var
  i: integer;
begin
  for i := 0 to Control.ChildCount-1 do
    SendMessage(Control.Children[i].Handle, WM_SIZE,0,0);

   _hi_OnEvent(_event_onResize);
end;
пробовал на свою месагу зацепить, лажает

nesco писал(а):
А свойства MinMax ты применяешь к методам KOL, или они только в твоем методе работают, а как они тогда на форме работают?

коловские не работают х.з почему, поэтому такая шляпа

поправил так


procedure THIWin.SetAnchors;
var
  w,h,d: integer;
begin
  Control.BeginUpdate;
  if Control.Align = caNone then
  begin
    //if not Control.HandleAllocated then Exit;

    // один раз инициализируем и пользуемся
    // в Init  Control.Parent. Width и Height не работают !
    if not InitSize then
    begin
      FOldTop := _prop_Top;
      FOldLeft := _prop_Left;
      FOldRight := Control.Parent.Width - (_prop_Left+_prop_Width);
      FOldBottom := Control.Parent.Height - (_prop_Top+_prop_Height);
      FOldWidth := _prop_Width;
      FOldHeight := _prop_Height;
      InitSize := True;
    end;

    if _prop_akRight then
    begin
      w := FParent.Width - (FOldLeft+FOldRight);
      h := Control.Height;
      if not _prop_akLeft then
      begin
        d := FParent.Width - (FOldWidth + FOldRight);
        SetWindowPos(Control.Handle, 0, d, [b]Control.Top[/b], FOldWidth, h, SWP_NOZORDER);
      end else
        SetWindowPos(Control.Handle, 0, FOldLeft, [b]Control.Top[/b], w, h, SWP_NOZORDER);
    end;

    if _prop_akBottom then
    begin
      w := Control.Width;
      h := FParent.Height - (FOldTop+FOldBottom);
      if not _prop_akTop then
      begin
        d := FParent.Height - (FOldHeight+FOldBottom);
        SetWindowPos(Control.Handle, 0, Control.Left, d, w, fOldHeight, SWP_NOZORDER);
      end else
        SetWindowPos(Control.Handle, 0, Control.Left, Control.Top, w, h, SWP_NOZORDER);
    end;

    end else begin

    case _prop_MaxHeight of
      0:;
    else if Control.Height > _prop_MaxHeight then Control.Height := _prop_MaxHeight; end;

    case _prop_MinHeight of
      0:;
    else if Control.Height < _prop_MinHeight then Control.Height := _prop_MinHeight; end;

    case _prop_MaxWidth of
      0:;
    else if Control.Width > _prop_MaxWidth then Control.Width := _prop_MaxWidth; end;

    case _prop_MinWidth of
      0:;
    else if Control.Width < _prop_MinWidth then Control.Width := _prop_MinWidth; end;

  end;

  Control.EndUpdate;
end;

--- Добавлено в 2022-01-14 17:01:59

это нужно обязательно поправить
if _prop_akRight then
begin
w := FParent.Width - (FOldLeft+FOldRight);
h := Control.Height;
if not _prop_akLeft then
begin
d := FParent.Width - (FOldWidth + FOldRight);
SetWindowPos(Control.Handle, 0, d, Control.Top, FOldWidth, h, SWP_NOZORDER);
end else
SetWindowPos(Control.Handle, 0, FOldLeft, Control.Top, w, h, SWP_NOZORDER);
end;

--- Добавлено в 2022-01-14 17:05:51

nesco писал(а):
Странно, почему у тебя инициализация в Init не работает, у меня работает прекрасно.

х.з Handle разные а размер один и тот же что для формы что для панели на ней. Соответственно и детки в этой панели балдеют
карма: 4
Мой форум - http://hiasm.bbtalk.me/ схемы, компоненты...
0
Редактировалось 2 раз(а), последний 2022-01-14 17:05:51