• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Bitmap of non full visible components

How can I make a bitmap of the full clientarea of a component when (a part of) the component is not visible.


0
Ronald Buster
Asked:
Ronald Buster
  • 3
  • 3
  • 3
  • +2
1 Solution
 
michaueCommented:
There is a application called SnagIt32 that does it for you ... You can set it up to AutoScroll when it takes it's input, and therefore it get the whole picture.  You can download a trail version from the web
0
 
michaueCommented:
You can get it at http://www.techsmith.com/
0
 
viktornetCommented:
Don't get what ya wnat. Please clarify things so it's easier to understand what ya want! 10x

Regards,
Viktor Ivanov
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Ronald BusterOwnerAuthor Commented:
Rejected because I need a bit of source in order to make it work into my program.

0
 
michaueCommented:
Sorry, I thought it was for putting together a manual or something ...  Hope someone else will be able to help you ...

Elfrieda
0
 
MadshiCommented:
Some components can paint themselves into a specified device context when receiving a WM_PAINT message. Some not. You'll have to try it...

An extract from my win32 help file:

"An application sends the WM_PAINT message when Windows or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.

WM_PAINT  
hdc = (HDC) wParam; // the device context to draw in
 

Parameters

hdc

Identifies the device context to draw in. If this parameter is NULL, use the default device context. This parameter is used by some common controls to enable drawing in a device context other than the default device context. Other windows can safely ignore this parameter."

Regards, Madshi.
0
 
ThaddyCommented:
For a simple answer i refer to my other one, here's some code that can do what you want.(Although this is a fragment) This is from my embeddable activeXfactory, so it's for ActiveX components, but you might rewrite it because it's really nothing more than pure pascal and api work.
Once you've got the metafi;le you can put it anywhere you like.
It takes the whole picture, not just the vsisble part.

Note that this is no job for beginners, you will get your feet wet...

procedure TCompoundDocActiveXControl.ScreenSnapShot;
  var
    hDC, RefDc : Windows.HDC;
    nY, nX : integer;
  begin

   with FwinControl do
        begin
        PerForm(WM_SETREDRAW, 0, 0);
        nY:= Height;
        nX:= Width;
        Height:= FcontrolSizeY;
        Width:= FcontrolSizeX;
        end;

    RefDC:= GetDC(0);
    hDC := CreateEnhMetaFile(RefDC, nil, nil, nil);
    SetMapMode(hDC, MM_ANISOTROPIC);

    FwinControl.PaintTo(hDC, 0, 0);
    FhMetaFile:= CloseEnhMetaFile(hDC);

    with Fwincontrol do
         begin
         Height:= nY;
         Width:= nX;
         PerForm(WM_SETREDRAW, 1, 0);
         end;

  end;

0
 
Ronald BusterOwnerAuthor Commented:
The answer is excellent but does it work on none wincontrol components I reward you with the 100 points for a excellent
answer

0
 
ThaddyCommented:
Alas, since you need a window handle, you can do this only with Twincontrols ( But almost anything usefull will be a Twincontrol descendant)
0
 
ThaddyCommented:
Alas, since you need a window handle, or rather a devicecontext handle (hDC), you can do this only with Twincontrols ( But almost anything usefull will be a Twincontrol descendant)
0
 
Ronald BusterOwnerAuthor Commented:
I need this in order to make a designer (a kind of form designer)

I thought I build this with bitmaps of controls, but I already
have another solution without bitmaps, just with the

perform(WM_SETREDRAW,1,0) the control doesn't get focus and the form receives all mouse clicks.

However since someone maybe has a better solution please let me know.


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now