Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7194669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:25:10+00:00 2026-05-28T20:25:10+00:00

Using Delphi 6 Prof. I created a bevel component for separation. Because I used

  • 0

Using Delphi 6 Prof.

I created a bevel component for separation.

Because I used spacers with 8 pixel (width x height) I thought that I create this component, and when I put it on a Form, I need only to set Align – and that’s all.

type
  TSSpacer = class(TBevel)
  public
    constructor Create(aOwner: TComponent); override;
  published
    //property Width default 8;
    //property Height default 8;
    property Shape default bsSpacer;
end;

constructor TSSpacer.Create(aOwner : TComponent);
begin
  inherited Create(aOwner);
  Shape := bsSpacer;
  Width := 8;
  Height := 8;
end;

But when I use this code (with or without “defaults”) the result is 140 x 41 pixels in the IDE.

So why does it not size to 8 x 8? And what is also interesting: the default TBevel is 50 x 50.

What causes this resizing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:25:11+00:00Added an answer on May 28, 2026 at 8:25 pm

    TLama hits the nail in his comments: somehow the designer prevents components from becoming too small. Strange though that the designer does not set this minimum size (10 x 10), but instead seems to randomly set the size to arbitrary values: 140 x 41 in D6 as stated by OP, and 100 x 41 here in D7.

    Well, since TBevel does use nor publish the AutoSize property, and that property name kind of relates to wished behaviour, I chose to stretch its use:

    type
      TSSPacer = class(TBevel)
      protected
        procedure SetParent(AParent: TWinControl); override;
      public
        constructor Create(AOwner: TComponent); override;
        procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
      published
        property Shape default bsSpacer;
      end;
    
    constructor TSSPacer.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      Shape := bsSpacer;
    end;
    
    procedure TSSPacer.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
    begin
      if AutoSize then
        inherited SetBounds(ALeft, ATop, 8, 8)
      else
        inherited SetBounds(ALeft, ATop, AWidth, AHeight);
    end;
    
    procedure TSSPacer.SetParent(AParent: TWinControl);
    begin
      AutoSize := (csDesigning in ComponentState) and (Parent = nil) and
        (AParent <> nil);
      inherited SetParent(AParent);
    end;
    

    This works here in D7, but a more reliable implementation might be:

      private
        FFixDesignSize: Boolean;
    
    procedure TSSPacer.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
    begin
      if FFixDesignSize then
      begin
        inherited SetBounds(ALeft, ATop, 8, 8);
        FFixDesignSize := False;
      end
      else
        inherited SetBounds(ALeft, ATop, AWidth, AHeight);
    end;
    
    procedure TSSPacer.SetParent(AParent: TWinControl);
    begin
      FFixDesignSize := (csDesigning in ComponentState) and (Parent = nil) and
        (AParent <> nil);
      inherited SetParent(AParent);
    end;
    

    And to complete this answer with a call stack of dropping this control in the designer on a form:

    - Before SetBounds
    - After SetBounds
    - Before SetBounds
    - After SetBounds
    - Before SetParent
        - Before SetBounds
        - After SetBounds
    - After SetParent
    - Before SetBounds
    - After SetBounds
    - Before SetParent
    - After SetParent
    

    But I think you should not rely on this specific order or number of calls: I suspect it might differ between Delphi versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Delphi 2010, and when I created a console application that prints
I`m using Delphi 2009 and want to operate some XML data. I heard that
Using Delphi 7, I wonder if there is a free component which will collect
I'm using Delphi 2010 to create a SOAP Server. The server is created as
I´m using Delphi 5 with SQL Server 2000 here. I have created an ADOQuery
I am using Delphi 6 Professional. I am interfacing with a DLL libraty that
Using Delphi Steema TeeChart component, if I link a BarSeries to a dataset using
I'm using Delphi and I'm building my own label component with class TControl. Before
Using Delphi 2010, I have used TSQLQuery and TSQLConnection to connect to a remote
Using Delphi, now that the Microsoft Jet Driver is no longer supported on 64bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.