ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Help required on TImageEnVect and Text zoom
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ksvenkat

India
6 Posts

Posted - Jul 11 2020 :  10:10:06  Show Profile  Reply
Dear Sir,

We have a requirement where we need to provide zooming facility for the text control

We are using the TImageEnVect component. WE have added the text using
ObjKind[-1] := iekMEMO ;

Code snippet is as follows :

Could you please advise us as to how to provide zooming facility for the text added to the ImageEnVect component?

TIA


------------------------------------------------------------------------------------------------

Procedure TfrmViewImage.AddText(aImageEnView : TImageEnVect);
var
  tmpFont:TFont;
begin
  Try
    aImageEnView.ObjKind[-1]    := iekMEMO ;
    aImageEnView.ObjLeft[-1]    := iLeft *5;
    aImageEnView.ObjTop[-1]     := iTop * 5;
    aImageEnView.ObjHeight[-1]  := 125;
    aImageEnView.ObjWidth[-1]   := 350;
    aImageEnView.ObjFontLocked[-1]          := false;
    aImageEnView.ObjMemoBorderStyle[-1]     := psclear;
    aImageEnView.ObjMemoCharsBrushStyle[-1] := bsClear;
    tmpFont:=TFont.Create;
    tmpFont.Color:=clWhite;
    tmpFont.Size:=36;
    tmpFont.Name:='Verdana'; 
    tmpFont.Style:=tmpFont.Style + [fsBold];
    aImageEnView.SetObjFont(-1,tmpFont);
    tmpFont.Free;
    aImageEnView.AddNewObject;
    aImageEnView.MouseInteractVt:=[miObjectSelect];
  Except
    On E : Exception do Begin
      MessageDlg('Error in adding text to image - ' + E.Message, mtError, [mbOk], 0);
    End;
  End;
end;

------------------------------------------------------------------------------------------------


ksvenkat77

xequte

38610 Posts

Posted - Jul 11 2020 :  21:49:44  Show Profile  Reply
Hi

Firstly, if it is a new project, use TIETextLayer rather than a text object:

https://www.imageen.com/help/TIETextLayer.html


Regarding zooming, do you mean when the text object is created, or whenever the image is zoomed?

In the example above, you can use:

tmpFont.Height := Base_Size * aImageEnView.Zoom div 100;

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ksvenkat

India
6 Posts

Posted - Jul 19 2020 :  05:50:13  Show Profile  Reply
Hello Nigel
Thank you for your suggestions. Requirement is to zoom the text that is placed inside the image component whenever mouse wheel is used

Hope this can be easily acheived

ksvenkat77
Go to Top of Page

xequte

38610 Posts

Posted - Jul 20 2020 :  22:04:37  Show Profile  Reply
Hi

You can use the OnMouseWheel event to size the font. Here is an example for a text layer:

procedure Tfmain.ImageEnView1MouseWheel(Sender: TObject; Shift: TShiftState;
    WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
var
  txtlyr: TIETextLayer;
begin
  // Size font of Text layers using mouse wheel
  if ( ImageEnView1.LayersCurrent > 0 ) and ( ImageEnView1.CurrentLayer.Kind = ielkText ) then
  begin
    txtlyr :=  TIETextLayer( ImageEnView1.CurrentLayer );
    if WheelDelta < 0 then
      txtlyr.Font.Size := txtlyr.Font.Size + 1
    else
      txtlyr.Font.Size := max( 1, txtlyr.Font.Size - 1 );
    ImageEnView1.Update();
    Handled := True;
  end;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: