TRect Trouble..

Hi, I have recently finished making my first ever component called TExtLabel. It basically, so far, shows any text with a very accurate and neat border around it; at least I thought so.

After looking at the output a few times I noticed that the furthest left and furthest right pixel was being cut-off and made some characters look a little blocky. I have tried to fix the problem but everything I do will not work.

I have included full source and the DPK file here:
http://www.inspire-fx.com/TExtLabel.zip

If anyone could maybe fix my source so that it shows the extra pixel on both left and right sides of the label I will award the points. :)

Thanks very much, Nat.
LVL 2
KrakkenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Slick812Commented:
hello Krakken, I looked at your code, and it seems that you are trying to Draw outside the controls paint area, so I added some code to expand the area of the control on the auto size for text, but I really did not see the "Left side" pixel not there, so All I did was increase the Right side of the control so the DrawText for offset rect to Right will have something to draw on - - - -



(Code removed at the request of the questioner because it is the code of the questioner.  I have saved the code for future reference only in the event it comes up again

Computer101
E-E Admin)

- - - - - - - - - - - - - - - - - - -
if you still have Left side problems, then you might adj that as well
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KrakkenAuthor Commented:
Okay i'm trying that now :)
I adapted some of the code from someone else so thanks for commenting out the bits I didn't need. ;)
0
KrakkenAuthor Commented:
Yes the left pixel is still missing. Sorry it only shows on certain fonts.

I can't seem to fix this either.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

KrakkenAuthor Commented:
No matter, done it! Thanks!
0
Slick812Commented:
you may want to increase the amount that you add to the Controls width, I used 3 pixels but 4 or 5 pixels may be better??

also you may want to change

if (rctFla and DT_CALCRECT <> 0) and ((Length(Caption) = 0) or
  ShowAccelChar and (Caption[1] = '&') and (Length(Caption) = 1)) then sText := ' ';

to

if (rctFla and DT_CALCRECT <> 0) and ((Length(Caption) = 0) or
  ShowAccelChar and (Caption[1] = '&') and (Length(Caption) = 1)) then Exit;

since there is no text drawn with a Space

and leave out the sText altogether and just use Caption
DrawText(Canvas.Handle, PChar(Caption),
0
KrakkenAuthor Commented:
Thanks again! :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.