trichview.com

trichview.support




Re: Variable RichViewPixelsPerInch


Return to index


Author

Message

Marcos Lommez

Posted: 08/20/2004 22:45:12


I have found the unit the have that variable

RVFuncs



"Marcos Lommez" <lommez@hotmail.com> escreveu na mensagem

news:412640cb$1@support.torry.net...

> Hi Sergey...

> I've installed version 1.9. And the variable RichViewPixelsPerInch doesnt

> exist anymore

> How can i rewrite the procedure GetTwipsPerPixel ?

>

> thanks

>

>

> here is the code:

>

>

> procedure TFrmChatRoom.RichViewEdit2SaveComponentToFile(

>   Sender: TCustomRichView; Path: String; SaveMe: TPersistent;

>   SaveFormat: TRVSaveFormat; var OutStr: String);

>

> function GetTwipsPerPixel: Double;

>   var DC: HDC;

>   begin

>     DC := CreateCompatibleDC(0);

>     if RichViewPixelsPerInch > 0 then

>       Result := (72*20) / RichViewPixelsPerInch

>     else

>       Result := (72*20) / GetDeviceCaps(DC, LOGPIXELSY);

>     DeleteDC(DC);

>   end;

>

> var

>    Img: TImage;

>    Stream: TStringStream;

> begin

>      if not (SaveMe is TImage) then

>         exit;

>      img := TImage(SaveMe);

>      case SaveFormat of

>        rvsfHTML:

>        begin

>             OutStr := Sender.SavePicture(rvsfHTML, Path,

> img.Picture.Graphic);

>             OutStr := Format('<IMG src="%s" width=%d height=%d

> alt="">',[OutStr, img.Width, img.Height]);

>        end;

>        rvsfRTF:

>        begin

>             Stream := TStringStream.Create('');

>             RVSaveImageToRTF(Stream, GetTwipsPerPixel,

img.Picture.Graphic,

> img.Width, img.Height, Sender.RTFOptions);

>             OutStr := Stream.DataString;

>             Stream.Free;

>       end;

>       rvsfText:

>       begin

>            if SaveMe is TButton then

>               OutStr :=  '['+TButton(SaveMe).Caption+']'

>            else if SaveMe is TImage then

>              OutStr := '<Image of '+TImage(SaveMe).Hint+'>';

>       end;

>      end;

> end;

>

>





Powered by ABC Amber Outlook Express Converter