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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Help required on TImageEnVect and Text zoom

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ksvenkat Posted - Jul 11 2020 : 10:10:06
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jul 20 2020 : 22:04:37
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
ksvenkat Posted - Jul 19 2020 : 05:50:13
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
xequte Posted - Jul 11 2020 : 21:49:44
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