?
Solved

TRect Trouble..

Posted on 2003-03-04
6
Medium Priority
?
262 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:Krakken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 34

Accepted Solution

by:
Slick812 earned 400 total points
ID: 8067226
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
 
LVL 2

Author Comment

by:Krakken
ID: 8067568
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
 
LVL 2

Author Comment

by:Krakken
ID: 8067668
Yes the left pixel is still missing. Sorry it only shows on certain fonts.

I can't seem to fix this either.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:Krakken
ID: 8067796
No matter, done it! Thanks!
0
 
LVL 34

Expert Comment

by:Slick812
ID: 8068672
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
 
LVL 2

Author Comment

by:Krakken
ID: 8068891
Thanks again! :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 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