trichview.com

trichview.support




Change field backcolor for Print/PrintPreview


Return to index


Author

Message

Jim Maguire

Posted: 06/29/2005 3:33:00


I don't want a background color for my form fields when the form is printed,

so I have a routine to change the background color of each field before and

after the print:


  ChangeFieldBackColor(rve1.RVData, clNone);

  rvActionPrintPreview.ExecuteTarget(rve1);

  ChangeFieldBackColor(rve1.RVData, clSilver);


The problem is I'm changing the font size at the same time.  The routine is

listed below.  THe

GetFieldStyleNo is a modification of you're routine and gets the cur style

no and must be changing the font size to the default of 10.


Is there a more direct, easier way of changing the backcolor of my fields?


function TLetterEditor.ChangeFieldBackColor(RVData: TCustomRVData; Color:

TColor): boolean;

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  Result := False;

  FColor := Color;


  for i := 0 to RVData.ItemCount-1 do

  begin

    if RVData.GetItemStyle(i)=rvsTable then

    begin

      table := TRVTableItemInfo(RVData.GetItem(i));


      for r := 0 to table.Rows.Count-1 do

        for c := 0 to table.Rows[r].Count-1 do

          if table.Cells[r,c]<>nil then

              Result := ChangeFieldBackColor(table.Cells[r,c].GetRVData,

Color); //recursive call

    end else

    if (RVData.GetItem(i).StyleNo <> rvsComponent)

    and (PChar(RVData.GetItemTag(i)) <> '') then

    begin

      FFieldInfo.Clear;

      FFieldInfo.FieldTag := PChar(RVData.GetItemTag(i));


      if (FFieldInfo.MergeType = mtDataEntry)

      or (FFieldInfo.MergeType = mtTwoWay) then

      begin

          if Color = clNone then

              RVData.GetItem(i).StyleNo := GetFieldStyleNo(rve1, clNone,

True)

          else

              RVData.GetItem(i).StyleNo := GetFieldStyleNo(rve1,

FFieldInfo.BackColor, True);

      end;

    end;

  end;

end;






Powered by ABC Amber Outlook Express Converter