Changeset 561 for trunk/Packages


Ignore:
Timestamp:
Apr 28, 2024, 12:39:51 AM (7 months ago)
Author:
chronos
Message:
  • Fixed: Resize Term window offscreen bitmap on screen size change. Needed for tablet PC where screen can rotate.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/BaseWin.pas

    r558 r561  
    476476
    477477procedure CreateOffscreen(var Offscreen: TBitmap);
    478 begin
    479   if Offscreen <> nil then
    480     Exit;
    481   Offscreen := TBitmap.Create;
    482   Offscreen.PixelFormat := TPixelFormat.pf24bit;
    483   if Screen.Height - yUnused < 480 then
    484     Offscreen.SetSize(Screen.Width, 480)
    485   else
    486     Offscreen.SetSize(Screen.Width, Screen.Height - yUnused);
    487   Offscreen.Canvas.FillRect(0, 0, Offscreen.Width, OffScreen.Height);
    488   Offscreen.Canvas.Brush.Style := TBrushStyle.bsClear;
     478var
     479  NewWidth: Integer;
     480  NewHeight: Integer;
     481begin
     482  if not Assigned(Offscreen) then begin
     483    Offscreen := TBitmap.Create;
     484    Offscreen.PixelFormat := TPixelFormat.pf24bit;
     485  end;
     486  if Screen.Height - yUnused < 480 then begin
     487    NewWidth := Screen.Width;
     488    NewHeight := 480;
     489  end else begin
     490    NewWidth := Screen.Width;
     491    NewHeight := Screen.Height - yUnused;
     492  end;
     493  if (Offscreen.Width <> NewWidth) or (Offscreen.Height <> NewHeight) then begin
     494    Offscreen.SetSize(NewWidth, NewHeight);
     495    Offscreen.Canvas.FillRect(0, 0, Offscreen.Width, OffScreen.Height);
     496    Offscreen.Canvas.Brush.Style := TBrushStyle.bsClear;
     497  end;
    489498end;
    490499
Note: See TracChangeset for help on using the changeset viewer.