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
 IECanvas can not show the text
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

152 Posts

Posted - Mar 30 2026 :  21:56:38  Show Profile  Reply
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;

xequte

39411 Posts

Posted - Mar 30 2026 :  22:31:14  Show Profile  Reply
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
Go to Top of Page

Flashcqxg

152 Posts

Posted - Mar 31 2026 :  01:13:42  Show Profile  Reply
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.
And also make the letter A zoom in, zoom out, or move along with the image at any time.
Go to Top of Page

xequte

39411 Posts

Posted - Mar 31 2026 :  19:42:06  Show Profile  Reply
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
Go to Top of Page

Flashcqxg

152 Posts

Posted - Apr 01 2026 :  02:28:47  Show Profile  Reply
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;
Go to Top of Page

xequte

39411 Posts

Posted - Apr 01 2026 :  14:45:41  Show Profile  Reply
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
Go to Top of Page

Flashcqxg

152 Posts

Posted - Apr 02 2026 :  18:40:20  Show Profile  Reply
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;
Go to Top of Page

xequte

39411 Posts

Posted - Apr 06 2026 :  16:40:28  Show Profile  Reply
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
Go to Top of Page

Flashcqxg

152 Posts

Posted - Apr 06 2026 :  18:27:19  Show Profile  Reply
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.
Go to Top of Page

xequte

39411 Posts

Posted - Apr 06 2026 :  21:17:12  Show Profile  Reply
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
Go to Top of Page

Flashcqxg

152 Posts

Posted - Apr 09 2026 :  08:45:28  Show Profile  Reply
Sorry,i found that my code does not achieve my requirements:

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.MouseInteractLayers := [mlMoveLayers];

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;

procedure TForm1.ImageEnView1LayerMoveSize(Sender: TObject; layer: Integer; event: TIELayerEvent; var PosX, PosY, Width, Height: Double);
begin
  ImageEnView1.ShowButtons := [];
  ImageEnView1.Layers[0].VisibleBox := True;
  ImageEnView1.Layers[0].Selectable := True;
  ImageEnView1.Layers[0].Locked := False;
  ImageEnView1.Update();
end;
Go to Top of Page

xequte

39411 Posts

Posted - Apr 09 2026 :  16:59:17  Show Profile  Reply
Sorry, I neglected to mention one point. XBmp2Scr/YBmp2Scr assumes a fixed background layer. You need to enable the CurrentLayer parameter to ensure it adjusts the value for the active layer, i.e.

  ImageEnView1.BackBuffer.Canvas.TextOut(ImageEnView1.XBmp2Scr(100, True), ImageEnView1.YBmp2Scr(100, True ), 'A');

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

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

Flashcqxg

152 Posts

Posted - Apr 09 2026 :  18:27:18  Show Profile  Reply
Thank you, the text display is fine now, but the code above still does not allow free dragging of the image. The code written in the onLayerMoveSize event is not working.
Go to Top of Page

xequte

39411 Posts

Posted - Apr 11 2026 :  05:01:20  Show Profile  Reply
You can't click the image and move it to a new position in the TImageEnView?

Does it show as selected (has a rect around it)?

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

Flashcqxg

152 Posts

Posted - Apr 12 2026 :  18:22:46  Show Profile  Reply
1.I can't click the image and move it to a new position in the TImageEnView.
2.it did not show as selected.
Go to Top of Page

xequte

39411 Posts

Posted - Apr 14 2026 :  18:42:30  Show Profile  Reply
Hi

It may be clashing with ImageEnMView1.AttachedImageEnView. Please just try assigning the content to the TImageEnView instead.

e.g.
ImageEnMView1.AssignTo( 3, ImageEnView1.IEBitmap );
ImageEnView1.Update();


https://www.imageen.com/help/TImageEnMView.AssignTo.html

If it still fails, please create a very simple demo showing the problem and email it to us.



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

Flashcqxg

152 Posts

Posted - Apr 15 2026 :  18:32:04  Show Profile  Reply
Hello,i have sent the demo to support@xequte.com.
Go to Top of Page

xequte

39411 Posts

Posted - Apr 27 2026 :  23:24:51  Show Profile  Reply
Hi

As mentioned above, you are using both:

ImageEnMView1.AttachedImageEnView := ImageEnView1;

and:
ImageEnMView1.AssignTo(idx, ImageEnView1.IEBitmap);


To assign the image every time you make a selection in the ImageEnMView.

You should remove the ImageEnMView1.AttachedImageEnView := ImageEnView1; line so it does not clash with TImageEnView functionality.


Also your Layers[0].Locked := False; code is never called. Move it to your ImageEnMView1ImageSelect event, e.g.

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.MouseInteractLayers := [mlMoveLayers];
end;

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

  ImageEnView1.ShowButtons := [];
  ImageEnView1.Layers[0].VisibleBox := True;
  ImageEnView1.Layers[0].Selectable := True;
  ImageEnView1.Layers[0].Locked := False;
  ImageEnView1.Update();
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, True),
                                         ImageEnView1.YBmp2Scr(100, True), 
                                         'A');
end;


That makes your demo work for me.


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

Flashcqxg

152 Posts

Posted - Apr 28 2026 :  18:43:49  Show Profile  Reply
The current code can now freely drag the position of the image as expected.
However, because ImageEnMView1.AttachedImageEnView := ImageEnView1 is commented out, I can no longer browse through images using the mouse(with iemwNavigate). Is there a solution?
I want to be able to browse each image with the mouse while also being able to freely drag the image position.
Go to Top of Page

xequte

39411 Posts

Posted - Apr 28 2026 :  22:42:23  Show Profile  Reply
Hi

I assume you mean when the TImageEnView is selected, it no longer communicates with the TImageEnMView to change the position?

You'll need to handle the mouse wheel for the TImageEnView yourself:

procedure TForm1.ImageEnView1MouseWheel(Sender: TObject; Shift: TShiftState;
    WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
  if WheelDelta < 0 then
    ImageEnMView1.Seek( ieioSeekPrior )
  else
    ImageEnMView1.Seek( ieioSeekNext );
  ImageEnMView1ImageSelect( ImageEnMView1, ImageEnMView1.SelectedImage );
  Handled := True;
end;


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

Flashcqxg

152 Posts

Posted - Apr 29 2026 :  18:20:53  Show Profile  Reply
Thank you, it's working normally now.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: