Journal for printscreen with white background
Journal for printscreen with white background
(OP)
Does anybody know how to record the print screen key stroke in journal to get a screenshot of current graphic window with white background. And then the screenshot picture can be pasted in other file or email. Thank you





RE: Journal for printscreen with white background
It does not put the image on your clipboard, but that should also be possible.
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() Sub Main() If IsNothing(theSession.Parts.BaseWork) Then 'active part required Return End If Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() 'change export location as needed ExportScreenshot("C:\Temp\NX_screenshot.png") lw.Close() End Sub Sub ExportScreenshot(ByVal filename As String) Dim wcsVisible As Boolean = theSession.Parts.Display.WCS.Visibility Dim triadVisible As Integer = theSession.Preferences.ScreenVisualization.TriadVisibility Try DeleteFile(filename) theSession.Parts.Display.WCS.Visibility = False theSession.Preferences.ScreenVisualization.TriadVisibility = 0 theUfSession.Disp.CreateImage(filename, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White) Catch ex As Exception MsgBox(ex.Message & ControlChars.NewLine & _ "'" & filename & "' could not be created") 'Return Finally theSession.Parts.Display.WCS.Visibility = wcsVisible theSession.Preferences.ScreenVisualization.TriadVisibility = triadVisible End Try End Sub Sub DeleteFile(ByVal filePath As String) 'does file exist? if so, try to delete it (overwrite) If IO.File.Exists(filePath) Then IO.File.Delete(filePath) End If End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Modulewww.nxjournaling.com
RE: Journal for printscreen with white background
CODE
Option Strict Off Imports System Imports System.Drawing Imports System.Windows.Forms Imports NXOpen Imports NXOpen.UF Module Module1 Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() Sub Main() If IsNothing(theSession.Parts.BaseWork) Then 'active part required Return End If Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() 'change export location as needed ExportScreenshot("C:\Temp\NX_screenshot.png") lw.Close() End Sub Sub ExportScreenshot(ByVal filename As String) Dim wcsVisible As Boolean = theSession.Parts.Display.WCS.Visibility Dim triadVisible As Integer = theSession.Preferences.ScreenVisualization.TriadVisibility Try DeleteFile(filename) theSession.Parts.Display.WCS.Visibility = False theSession.Preferences.ScreenVisualization.TriadVisibility = 0 theUfSession.Disp.CreateImage(filename, UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White) Catch ex As Exception MsgBox(ex.Message & ControlChars.NewLine & _ "'" & filename & "' could not be created") 'Return Finally theSession.Parts.Display.WCS.Visibility = wcsVisible theSession.Preferences.ScreenVisualization.TriadVisibility = triadVisible End Try 'copy image to clipboard Dim theImage As Bitmap = CType(Image.FromFile(filename), Bitmap) Clipboard.SetImage(theImage) End Sub Sub DeleteFile(ByVal filePath As String) 'does file exist? if so, try to delete it (overwrite) If IO.File.Exists(filePath) Then IO.File.Delete(filePath) End If End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Modulewww.nxjournaling.com
RE: Journal for printscreen with white background
Thank you so much for your response. I think putting the image to the clipboard is exactly what I want. Since I might need to take more than one screenshot in one job and I even don't need to save them. I just need to screenshot it and then ctrl + V to paste it to email. This would be better for me than saving the picture, finding it, and attached it to email. Since when I click the printscreen key I always forget to change the background to white, I am trying to find a solution to incorporate changing background color into the printscreen hotkey. In this case, The screenshot will be white automatically once I click the printscreen or other hotkey.
Is there any code for putting the screen shot image to clipboard?
Thanks.
RE: Journal for printscreen with white background
Yes. See my 2nd post (above).
www.nxjournaling.com
RE: Journal for printscreen with white background
I have tried this code and they are working perfectly. Thank you so much for the help
RE: Journal for printscreen with white background
"Copy Display".
Menu- Edit- Copy Display.
It's smart in the fashion that IF the display is STATIC wireframe mode, it will copy vectors, IF the display is Shaded mode, it will copy a bitmap.
The Vectors are scale-able without loss. ( and can be converted to, at least, powerpoint objects.)
Regards,
Tomas
RE: Journal for printscreen with white background
RE: Journal for printscreen with white background
http://nxjournaling.com/content/create-screenshot-...
www.nxjournaling.com
RE: Journal for printscreen with white background