Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Shade background
  FAQ FAQ  Forum Search   Register Register  Login Login

Shade background

 Post Reply Post Reply
Author
Message
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Topic: Shade background
    Posted: 03 Aug 10 at 6:28PM
I want to draw some text (in black) then fill the background with a light gray color.
Can anyone give me an example of how to do that.
I have tried transparency and setfillcolor and nothing seems to work.
Here is a snippet of my code.
 
    x := LeftMargin ;
    PDF.DrawText(x, y, 'Form ID') ;
    PDF.DrawText(x+wFormID, y, 'Form Description') ;
    y := y + LineHeight ;
    PDF.DrawText(x, y, 'Pages') ;
    PDF.DrawText(x+wFormID, y, 'DCN') ;
    y := y + (LineHeight div 4) ;
    PDF.DrawLine(x, y, PDF.PageWidth-RightMargin, y) ;
    // Here is where I want to shade the background and I have no idea what colors make light gray
    PDF.SetFillColor(10,10,10) ;
    PDF.SetTransparency(70) ;
    PDF.DrawBox(LeftMargin, SaveY, PDF.PageWidth-LeftMargin-RightMargin, y-SaveY, 2) ;
    PDF.SetTransparency(0) ;
    y := y + LineHeight ;
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Aug 10 at 9:14PM
Hi Wayne!

I've taken some code out of one of my components:
//. . .
var
colr, colg, colb : Double;

  if ( rgb1 = '' ) then
     rgb1 := '1,0';
  if ( rgb2 = '' ) then
     rgb2 := '1,0';
  if ( rgb3 = '' ) then
     rgb3 := '1,0';

  colr := StrToFloat(rgb1);
  colg := StrToFloat(rgb2);
  colb := StrToFloat(rgb3);

  QP2 := TQuickPDF0717.Create;
  try
     QP2.UnlockKey('...');
//   . . .
     QP2.SetFillColor(colr,colg,colb);
//   . . .
     QP2.DrawText(...);
//   . . .
  Finally
     QP2.SaveToFile...;
     QP2.Free;
  end;
//. . .
 
Please keep in mind that we're talking about RGB-colors.
The max-value for R, G and B is 1!
...(1.0, 1.0, 1.0) means white
...(0.0, 0.0, 0.0) means black.
Make some tests with values below 1.0 ...

Cheers, Ingo


Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 03 Aug 10 at 9:22PM
worked great. I am a bone head I forget what the ranges were for the RGB colors.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store