We help IT Professionals succeed at work.
Get Started

TBitmap.Canvas.TextWidth problem

chongkeng_woon
on
1,304 Views
Last Modified: 2008-03-26
assuming i created a TBitmap (bm) as global variable on top ....then,

function TForm1.test();
function getTextWidth(var bm:TBitmap):integer;
var s:string;
var b : tfont;
begin
  s := 'From TransNo: []   To TransNo: []     From Salesman: []   To Salesman: []     From Date: [01/10/2007]   To Date: [31/10/2007]';
  b := TFont.create;
  b.Name := 'Times New Roman';
  b.Size := 8;
  bm.canvas.Font.Assign(b);
  result  := bm.canvas.textwidth(s);
end;

begin
  aWidth := getTextWidth(bm);
  .....
  ..... (other source code)
  .....
  .....
  aWidth := getTextWidth(bm);
end;

at first time, my aWidth value = 595, while the 2nd time , it return 1950; the source code in between have changed my TBtimap property ...is there anyway i can list out all properties of TBitmap object (e.g. size, width ...) so that i can compare what have been changed before and after ...?

thanks


Comment
Watch Question
Sr. Software Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE