Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

getting the print screen image of a graphic view


Recommended Posts

Hello,

 

I have another question regarding Nethook options.

 

I would like to make a printscreen image of a graphic view.

I can succesfully save the image of the entire screen. I use this method for this:

 

        	Rectangle bounds = Screen.GetBounds(Point.Empty);

       	// create the bitmap to copy the screen shot to
       	Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height);

       	// now copy the screen image to the graphics device from the bitmap
       	using (Graphics gr = Graphics.FromImage(bitmap))
       	{
           	gr.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
       	}

       	return bitmap;

 

But the problem is that this method returns image of the entire screen.

 

I would like to get the image of only a graphic window.

 

I see 2 possible solutions to this:

  • get the bounds of the graphic screen and use them in the previously shown method
  • use direct function from mastercam (if it exists) to get the image directly (like the Screen/To clipboard function inside of Mastercam)

I was checking the Nethhok help but I see no option to achieve any of these using nethook functions.

 

Any of the solutions would be greatly appreciated.

 

Thanks

Link to comment
Share on other sites

Gorazd,

 

Have you tried ...

 

Mastercam.Mastercam.IO.FileManager.SaveToBitmap(String FilePath)

 

"This is used to save the graphics view of the currently opened file to a bitmap file."

 

Parameters: FilePath (String)

This should be the full, backslash-delimited path of the bitmap file you wish to create.

 

Return Value:

True if the bitmap file was created successfully and false if not.

Link to comment
Share on other sites

Yes, that's it.

 

If the current graphic screen is 1052x897 (it depends on the size of the screen and the number of toolbars the user has ) I want to capture it into the image of the same size.

 

I always wandered why the SaveToBitmap(String FilePath) didn't save to a large image.

Ususaly we need printscreens bigger than 256x256.

 

I want to have the same functionality as "Screen/Copy screen image to clipboard" does (it creates imege of the graphic screen in the original size).

 

Best regards.

Link to comment
Share on other sites
  • 10 years later...

Hello and a lucky new year to you all,

i have a further question about creating screenshot or better creating a print like File/Print.

Let's assume, that the setup for printer, orientation, color etc. is done.
Is it then possible to control that print function with a chook-function (in MC2019 and above) ?

Maybe the undocumented function "send_file_to_printer(class CStdioFile *, int, wchar_t *)" is the key for that?

Please help.

Best regards

Link to comment
Share on other sites

Thank you Roger,

 

that works fine.

But now i have found that i cant't store that print in a file without manually enter the path (with an pdf printer driver).  That's what i want to avoid.

Now i think like acam did. Make a printscreen image and than store it as a bmp in the directory where the mc-file lives.

I'm able to store that bmp with "screen_to_bitmap_file(...)"

 That works also. But what if i want to manipulate that image before storing it. Saw the function "screen _to_Bitmap(...)" and got the same problems as acam.

How to get the bitmap-size in "graphic screen in the original size"?

 

Best regards

Norbert

 

 

Link to comment
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...