Solved

TToolbar with a background image

Posted on 1998-09-25
1
360 Views
Last Modified: 2010-04-06
I would like to have the TToolBar component have a background image like in IE3. I know that this is done by placing a Coolbar on your form and then placing a Toolbar on top of it, setting the Flat property to true.

However, I do not want to use the TCoolbar componet, I would just like to have a TToolbar which has the background image itself. I have tried writing a component based upon the TToolbar but have had no joy in getting the Bitmap to draw on it.

Could someone help me out here? Isn't it just a case of having a Bitmap property on the TToolbar component and then showing that bitmap if the designer loads one?
0
Comment
Question by:jsweby
1 Comment
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 1340857
Yes, basically it's that easy.

  TJswebysGreatToolbar = class(TToolBar)
  private
    procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
  end;

procedure TJswebysGreatToolbar.WMEraseBkgnd(var Message: TWMEraseBkgnd);
var canvas : TCanvas;
begin
  canvas:=TCanvas.Create;
  try
    canvas.handle:=Message.dc;
    try
      // here do the painting on "canvas"...
    finally canvas.handle:=0 end;
  finally canvas.Free end;
end;

Regards, Madshi.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
code issue 8 129
Delphi - replicating a form 8 73
QRReport  TQrmemo vertical stretching 1 45
TServerSocket - file via sendbuf or Text via sendtext ? 1 53
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question