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
 IECanvas can not show the text

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
Flashcqxg Posted - Mar 30 2026 : 21:56:38
In my code below, the output letter A only flashed briefly and then disappeared.


procedure TForm1.FormShow(Sender: TObject);
var
  Path: string;
begin
  Path := ExtractFilePath(ParamStr(0));
  ImageEnMView1.LoadFromFileOnDemand(Path + '1.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '2.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '3.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '4.jpg', true);

  ImageEnMView1.StoreType := ietNormal;
  ImageEnMView1.ThumbWidth := 100;
  ImageEnMView1.ThumbHeight := 80;
  ImageEnMView1.MouseWheelParamsAlt.Action := iemwNone;
  ImageEnMView1.MouseWheelParams.Action := iemwNavigate;

  ImageEnMView1.AttachedImageEnView := ImageEnView1;
  ImageEnView1.MouseWheelParams.Action := iemwNavigate;
  ImageEnView1.MouseWheelParamsAlt.Action := iemwZoom;

end;

procedure TForm1.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  ImageEnView1.ClearAll;
  ImageEnMView1.CopyToIEBitmap(idx, ImageEnView1.IEBitmap);

  ImageEnView1.IEBitmap.IECanvas.Font.Color := clRed;
  ImageEnView1.IEBitmap.IECanvas.Font.Size := 50;
  ImageEnView1.IEBitmap.IECanvas.Font.Style := [TFontStyle.fsBold];
  ImageEnView1.IEBitmap.IECanvas.TextOut(100, 100, 'A');

  ImageEnView1.Update;
end;
10   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 06 2026 : 21:17:12
Hi

> A does not move along with the picture, but I need the position of the letter A to change as the picture's position changes.

If you are drawing to the BackBuffer, remember that x,y are screen values, so to make it always appear on the same place on the image, you need to convert your bitmap values to screen values.

See:
http://www.imageen.com/help/TImageEnView.XBmp2Scr.html
http://www.imageen.com/help/TImageEnView.YBmp2Scr.html


> Can the image dragging event only be triggered within a button event? I hope that in the future, a property will be added to allow or disallow dragging the image.

You can use the OnLayerMoveSize to handle layer movement, including resetting the move position or size:

http://www.imageen.com/help/TImageEnView.OnLayerMoveSize.html

Nigel
Xequte Software
www.imageen.com
Flashcqxg Posted - Apr 06 2026 : 18:27:19
Thank you.
But now another problem has arisen: the letter A does not move along with the picture, but I need the position of the letter A to change as the picture's position changes.
And another question: can the image dragging event only be triggered within a button event? I hope that in the future, a property will be added to allow or disallow dragging the image.
xequte Posted - Apr 06 2026 : 16:40:28
Hi

Can you run the demo:

\Demos\Multi\MView_AttachedViewer\MViewPreview.dpr

And add a button with this code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ImageEnView1.ShowButtons := [];

  // Make background layer selectable and sizeable
  ImageEnView1.Layers[0].VisibleBox := True;
  ImageEnView1.Layers[0].Selectable := True;
  ImageEnView1.Layers[0].Locked     := False;
  ImageEnView1.Update();

  ImageEnView1.MouseInteractLayers := [mlMoveLayers];
end;

And let me know if you can move the layer?

Nigel
Xequte Software
www.imageen.com
Flashcqxg Posted - Apr 02 2026 : 18:40:20
I have added the code to move the image, but after compiling, it still cannot move.

procedure TForm1.FormShow(Sender: TObject);
var
  Path: string;
begin
  Path := ExtractFilePath(ParamStr(0));
  ImageEnMView1.LoadFromFileOnDemand(Path + '1.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '2.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '3.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '4.jpg', true);

  ImageEnMView1.StoreType := ietNormal;
  ImageEnMView1.ThumbWidth := 100;
  ImageEnMView1.ThumbHeight := 80;
  ImageEnMView1.MouseWheelParamsAlt.Action := iemwNone;
  ImageEnMView1.MouseWheelParams.Action := iemwNavigate;

  ImageEnMView1.AttachedImageEnView := ImageEnView1;
  ImageEnView1.MouseWheelParams.Action := iemwNavigate;
  ImageEnView1.MouseWheelParamsAlt.Action := iemwZoom;

  ImageEnView1.MouseInteractGeneral := [miScroll];

  ImageEnView1.Layers[0].Locked := False;
  ImageEnView1.MouseInteractLayers := [mlMoveLayers];

end;
xequte Posted - Apr 01 2026 : 14:45:41
Hi

By default, layer 0 (the image or background) is not moveable.

If you set:

ImageEnView1.Layer[0].Locked := False;
ImageEnView1.MouseInteractLayers := [mlMoveLayers];

Then you can move it.

Record the ImageEnView1.Layer[0].PosX/PosY to apply to the next image.



Nigel
Xequte Software
www.imageen.com
Flashcqxg Posted - Apr 01 2026 : 02:28:47
Thank you! The text can now be displayed.

However, in my code, I have set ImageEnView1.MouseInteractGeneral := [miScroll], which only allows dragging the image when it is larger than the display area. I now need the following:

1.Whether the image is larger or smaller than the display area, it should be possible to drag the image to any position.

2.When switching images by scrolling the mouse, the newly switched image should display at the previously manually set position.


procedure TForm1.FormShow(Sender: TObject);
var
  Path: string;
begin
  Path := ExtractFilePath(ParamStr(0));
  ImageEnMView1.LoadFromFileOnDemand(Path + '1.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '2.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '3.jpg', true);
  ImageEnMView1.LoadFromFileOnDemand(Path + '4.jpg', true);

  ImageEnMView1.StoreType := ietNormal;
  ImageEnMView1.ThumbWidth := 100;
  ImageEnMView1.ThumbHeight := 80;
  ImageEnMView1.MouseWheelParamsAlt.Action := iemwNone;
  ImageEnMView1.MouseWheelParams.Action := iemwNavigate;

  ImageEnMView1.AttachedImageEnView := ImageEnView1;
  ImageEnView1.MouseWheelParams.Action := iemwNavigate;
  ImageEnView1.MouseWheelParamsAlt.Action := iemwZoom;

  ImageEnView1.MouseInteractGeneral := [miScroll];

end;

procedure TForm1.ImageEnView1DrawBackBuffer(Sender: TObject);
begin
  ImageEnView1.BackBuffer.Canvas.Font.Color := clRed;
  ImageEnView1.BackBuffer.Canvas.Font.Height := Round(50 * ImageEnView1.Zoom / 100);
  ImageEnView1.BackBuffer.Canvas.Font.Style := [TFontStyle.fsBold];
  ImageEnView1.BackBuffer.Canvas.TextOut(ImageEnView1.XBmp2Scr(100), ImageEnView1.YBmp2Scr(100), 'A');
end;
xequte Posted - Mar 31 2026 : 19:42:06
OK, in that case you should just draw the letter to the bitmap/canvas as it is output (rather than try to change image itself).

It sounds like the OnDrawBackBuffer event is best for what you are doing. See the examples at:

http://www.imageen.com/help/TImageEnView.OnDrawBackBuffer.html

Alternatively, if it changes frequently, e.g. as the cursor moves over the image use the OnDrawCanvas event:

http://www.imageen.com/help/TImageEnView.OnDrawCanvas.html


Note:
- Use the ImageEnView1.Zoom value to scale your Font.Height (not Font.Size) based on the current zoom
- Use XBmp2Scr, YBmp2Scr to adjust the text X, Y position if you want it to always appear in the same place on the image (i.e. not affected by scrolling).

http://www.imageen.com/help/TImageEnView.XBmp2Scr.html


Something like:

// Draw "A" at 100,100 over the image
procedure TForm1.ImageEnView1DrawBackBuffer(Sender: TObject);
begin
  ImageEnView1.BackBuffer.Canvas.Font.Color := clRed;
  ImageEnView1.BackBuffer.Canvas.Font.Height := Round( 50 * ImageEnView1.Zoom / 100 );
  ImageEnView1.BackBuffer.Canvas.Font.Style := [TFontStyle.fsBold];
  ImageEnView1.BackBuffer.Canvas.TextOut( ImageEnView1.XBmp2Scr(100), ImageEnView1.YBmp2Scr(100), 'A');
end;


Nigel
Xequte Software
www.imageen.com
Flashcqxg Posted - Mar 31 2026 : 02:04:42
And also make the letter A zoom in, zoom out, or move along with the image at any time.
Flashcqxg Posted - Mar 31 2026 : 01:13:42
1.I don't want to edit the image;
2.I just just to temporarily display an A over the image while it is showing.
xequte Posted - Mar 30 2026 : 22:31:14
Hi

1. These two achieve the same thing:

ImageEnMView1.AttachedImageEnView := ImageEnView1;

and

ImageEnMView1.CopyToIEBitmap(idx, ImageEnView1.IEBitmap);


Decide which one you want to use. The first for automatic handling, the second to do it yourself (which is better if you plan to edit the image in the TImageEnView).


2. Are you wanting to permanently modify the image (Add an A to it and save) or are you wanting just to temporarily display an A over the image while it is showing?



Nigel
Xequte Software
www.imageen.com