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 7062951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:39:21+00:00 2026-05-28T04:39:21+00:00

Delphi XE2. There is a form & a frame. The form and the frame

  • 0

Delphi XE2. There is a form & a frame.

The form and the frame are doublebuffered. GlassFrame is enabled.

I paint frame’s background and try to draw a right aligned rectangle but have bugs. Especially I have bugs while resizing.

The rectangle doesn’t want to be drawn normally from transparency to the opaque black color.
enter image description here

uses ...GDIPAPI, GDIPOBJ...
type
  TFrame2 = class(TFrame)
    procedure PaintWindow(DC: HDC); override;

  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation
{$R *.dfm}

procedure TFrame2.PaintWindow(DC: HDC);
var
  R: TGPRect;
  pen: TGPPen;
  Graphics: TGPGraphics;
  linGrBrush: TGPLinearGradientBrush;
begin
  R.X := 0;
  R.Y := 0;
  R.Width := self.Width;
  R.Height := self.Height;

  Graphics := TGPGraphics.Create(DC);

  linGrBrush := TGPLinearGradientBrush.Create(R, MakeColor(255, 120, 248, 253),
    MakeColor(255, 200, 216, 250), LinearGradientModeVertical);

  Graphics.FillRectangle(linGrBrush, 0, 0, R.Width, R.Height);
  linGrBrush.Free;

    linGrBrush := TGPLinearGradientBrush.Create(MakePoint(0, 0),
MakePoint(189, 2), MakeColor(0, 0, 0, 0), MakeColor(255, 0, 0, 0));

  Graphics.FillRectangle(linGrBrush, R.Width - 189, 79, 189, 2);

  linGrBrush.Free;
  Graphics.Free;
end;

Please help me to draw a rectangle on the gradient frame normally from transparency to the opaque black color.

  • 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-28T04:39:22+00:00Added an answer on May 28, 2026 at 4:39 am

    Changing the code like shown below will draw a right aligned thin line from transparency to black opaque.

    linGrBrush := TGPLinearGradientBrush.Create( 
      MakePoint(R.Width-189,0), MakePoint(R.Width,2),
      MakeColor(0, 0, 0, 0),
      MakeColor(255, 0, 0, 0));
    Pen := TGPPen.Create( linGrBrush,3);
    Graphics.DrawLine(Pen,R.Width-189,79,R.Width,79);
    InvalidateRect(Handle,Rect(0,0,R.Width,R.Height),False);
    

    Update, using InvalidateRect for the whole area forces a total redraw of the frame.
    Otherwise the redraw might be clipped in strange ways.
    This will solve your color change effect.

    But a GlassFrame defect is illustrated with the last two images below. The outside frame of the TFrame is not correctly visible on the top and upper sides.

    enter image description here

    GlassFrame enabled
    GlassFrame disabled

    Showing dysfunction of TFrame when GlassFrame is enabled (left).
    The right picture shows a complete black frame (even though in this picture the right side was cropped in compression) with GlassFrame disabled.

    Update 2 :

    Enable SheetOfGlass and everything seems ok.

    enter image description here

    Update 3 :

    The GlassFrame top property was set to 40, and caused the strange border effect around the frame. Setting it to 0 fixed this issue.

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

Sidebar

Related Questions

The Delphi XE2 skinning option is fantastic, but there are cases where you want
There is a new file [project-name].otares created in Delphi XE2. The wiki says: File
Delphi 6 is pretty old, I know. Unfortunately there are reasons why I can't
Using Delphi 7, I wonder if there is a free component which will collect
I am trying to write an iPhone app using Delphi XE2 / FireMonkey and
QC#101189 I'm trying to custom draw a progress bar in a Delphi TListView as
Yesterday I installed Delphi XE2 using the download option, so I guess the installed
Let's admit, I create new package in Delphi Xe2. I keep under a name
I have a Delphi XE2 Firemonkey application that I want to run on both
Running the following code in Delphi XE2 Win32 platform works. However, the same code

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.