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
 MultiView2 demo
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

John

USA
94 Posts

Posted - Feb 23 2016 :  22:07:54  Show Profile  Reply
Hello

In the MultiView2 demo, which utilizes an ImageEnMView component, when an image is dragged vertically, a red dotted line is drawn in the space where the image would be if dropped. This action is coded in the ImageEnMView.OnAfterEvent event. I have a scenario where I am drag and dropping an image in the new ImageEnFolderMView component which orients the images horizontally.

The OnAfterEvent code from the demo provides a horizontal line over the image in front of where the image to be dropped would be. Does anyone have an idea as to how to display the red dotted line vertically in the space between the two images where the drop would occure?

TIA

John

w2m

USA
1990 Posts

Posted - Feb 24 2016 :  09:25:32  Show Profile  Reply
The MultiView2 demo uses a ImageEnMView with its alignment property (vertically aligned) set to alLeft with a GridWidth property set to 1 (one column). To display a horizontally aligned ImageEnMView set the ImageEnMView Align property to alTop or alBottom (horizontal) and the GridWidth property to 0 (one row).

// Accepts drag/drop. Draws a line to signal where to insert images
procedure TMainForm.ImageEnMView1DragOver(Sender, Source: TObject;
  X, Y: Integer; State: TDragState; var Accept: Boolean);
var
  im: Integer;
  imgX, imgY: Integer;
begin
  if Source = ImageEnMView1 then
  begin
    Accept := true;
    im := ImageEnMView1.InsertingPoint(X, Y);
    imgX := ImageEnMView1.ImageX[im];
    imgY := ImageEnMView1.ImageY[im];
    ImageEnMView1.Paint;
    with ImageEnMView1.GetCanvas do
    begin
      Pen.Color := clRed;
      Pen.Style := psDot; // display a dotted line
      Pen.Width := 1;  // a dotted line only works if pen width is 1 otherwise it will be a solid line
      // draw the line vertically at the insert point
      MoveTo(imgX, imgY);
      LineTo(imgX, imgY + ImageEnMView1.ThumbHeight - 10);
    end;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

John

USA
94 Posts

Posted - Mar 01 2016 :  17:42:39  Show Profile  Reply
William

With regard to the OnDragOver and OnDragDrop, the ImageEnMView and ImageEnFolderMView behave (in my experience) in a similar manner.

In my particular situation the ImageEnFolderMView.Align := Client. In this scenario, the images are aligned horizontally. The code you provided displays the red dotted line vertically which is what I needed. The code in my example displayed the red dotted line over the image in front of the location where the dragged image was to be dropped.

Thanks again for your efforts.

John

p.s. As an aside, did you ever publish a second edition to your ImageEn manual?

Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 01 2016 :  18:03:08  Show Profile  Reply
The current version of the ImageEn Developer manual is version 2. If you only have version 1 send me an email and I will send you the download link.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: