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
 Image distorted
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Mar 03 2019 :  11:18:23  Show Profile  Reply
I create a Bitmap in this way:

function Control2Bitmap(Control_: TWinControl): TBitmap;
begin
  Result := TBitmap.Create;
  with Result do begin
    Height := Control_.Height;
    Width  := Control_.Width;
    Canvas.Handle := CreateDC(nil, nil, nil, nil);
    Canvas.Lock;
    Control_.PaintTo(Canvas.Handle, 0, 0);
    Canvas.Unlock;
    DeleteDC(Canvas.Handle);
  end;
end;

procedure TFormMain.tbtnGetPicGridClick(Sender: TObject);
var
  ThisBitmap: TBitmap;
begin
  ThisBitmap := Control2Bitmap(FlowPanel);
  CodeSite.Send('TFormMain.tbtnGetPicGridClick: ThisBitmap', ThisBitmap);
  ImageEnView1.Bitmap.Assign(ThisBitmap);
  ThisBitmap.ReleaseHandle;
  ThisBitmap.Free;
end;


But the image looks distorted (although ImageEnView1.LegacyBitmap = True):



How can I get a clean bitmap?

PeterPanino

933 Posts

Posted - Mar 03 2019 :  11:29:59  Show Profile  Reply
Solved:

ImageEnView1.IEBitmap.CopyFromTBitmap(ThisBitmap);
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: