Delphi. Remove a border of TabSheet of PageControl

前端 未结 4 1519

Your help is needed.

Is it possible to remove a border of TabSheet (~4px)? I am using PageControl as a switch-panel instead of frames, windows etc. I want everything wil

相关标签:
4条回答
  • 2021-02-05 19:52

    If you don't mind using third-party tools then the easiest solution would probably be to use TjvPageControl from JVCL. It has ClientBorderWidth property which you are looking for.

    0 讨论(0)
  • 2021-02-05 19:56

    An alternative is to use a TTabSet with a TPageControl: In the onCreate event of the form, place this code to hide the tab.

    procedure TMainForm.FormCreate(Sender: TObject);
    var
        I : Integer;
    begin
       for I := 0 to Pred(PageControl1.PageCount) do
           PageControl1.Pages[I].TabVisible := False;
       PageControl1.Style := tsFlatButtons;
       PageControl1.ActivePageIndex := 0;
    
       TabSet1.Style := tsModernPopout;
       TabSet1.SelectedColor := clMoneyGreen;
       TabSet1.UnselectedColor := clGradientActiveCaption;
       TabSet1.SelectedColor := clGradientActiveCaption;
    end;
    
    
    procedure TMainForm.TabSet1Change(Sender: TObject; NewTab: Integer;
      var AllowChange: Boolean);
    begin
       PageControl1.ActivePageIndex := NewTab;
    end;
    
    0 讨论(0)
  • 2021-02-05 20:15
    unit Unit1;
    
    interface
    
    uses
      ...,
      CommCtrl;
    
    type
      TPageControl = class(ComCtrls.TPageControl)
      private
        procedure TCMAdjustRect(var Msg: TMessage); message TCM_ADJUSTRECT;
      end;
    
      TForm1 = class(TForm)
        ...
      end;
    
    ...
    
    procedure TPageControl.TCMAdjustRect(var Msg: TMessage);
    begin
      inherited;
      if Msg.WParam = 0 then
        InflateRect(PRect(Msg.LParam)^, 4, 4)
      else
        InflateRect(PRect(Msg.LParam)^, -4, -4);
    end;
    
    ...
    
    end.
    
    0 讨论(0)
  • 2021-02-05 20:15

    nowadays, that is the answer. No need any code hacks
    Probably you use themes, if not, you should use that technology:

    • Project Options > Application> Appearance

    • Check on one of them as Default Style)

      than :

    • Tools > Bitmap Style Designer > Open Style
    • Navigate your vsf style file
      (probably right here "C:\Users\Public\Documents\Embarcadero\Studio[VERSION]\Styles

    • Now In Bitmap Style Designer.. navigate to:
      Objects > Tabs > Frame > Bitmap

    • Click [...] three dot button of Bitmap In Inspector
    • Zoom to 800%
    • Pan/Scroll and Focus on to bitmap rectangle range.
    • Right Mouse Click to change Upper-Left, Left Mouse Click to change Lower-Right region.
      (so select inner rectangle to eliminate border bitmap now you have borderless page controls)
    0 讨论(0)
提交回复
热议问题