When I made a screen shot on my MacBook Pro Retina, I have a 144 dpi image file.
I used LB.DrawIntro and set it to the Clipboard
and I get a 72 dpi image in the Clipboard.
FWIW
PS: tested on El Capitan / Xojo 2015r1 AND Xojo 2019r3.1.
Same (but different) on Windows 10, 96 dpi
Different ? The Clipboard is not exported using VirtualBox, but a Paste into Paint and I was able to save it into a png file.
Did you create a 72 DPI or 144 picture for it to draw into ?
Default one as displayed in an example from the docs (ListBox DrawInto). Excact same code
So, 72 dpi on macOS and 96 on Windows 10.
PushButton code:
[code]Sub Action()
// Copy the ListBox contents as Image in the Clipboard
Dim Clip As New Clipboard
Dim My_Pict As New Picture(LB.Width, LB.Height, 32)
// Do nothing if the ListBox is empty
If LB.ListCount = 0 Then
Beep
Return
End If
// Store the ListBox data as Image
LB.DrawInto(My_Pict.Graphics, 0, 0)
Clip.Picture = My_Pict
// Export the data in the Clipboard
Clip.Close
End Sub[/code]
On the oher way (cmd-shift-4), both are 144dpi (done on the macOS part).
Copy As Text seems to works fine on both platforms.
Right so dont use the example code
this line
Dim My_Pict As New Picture(LB.Width, LB.Height, 32)
Gives you a 72 ppi picture and if you want one that is 2 x you need something more like
Dim My_Pict As Picture= Window.BitmapForCaching((LB.Width, LB.Height)
and this should give you a picture that i set to 144 dpi to draw into
Thanks Norman.
The question in my mind was
How DrawInto data are under the hood ?
Back to your answer:
BitmapForCaching was added in 2016r1 / I run 2015r1.
OK: i will let this example as is
I add a comment as a reminder (if running in 2016r1 or later, use
)
DrawInto draws a picture of what you see on the screen
It doesn’t draw everything IN the listbox
If you only have 5 rows visible but the listbox contains 100 you’ll only see the visible rows drawn
HOW it does this of course varies from macOS to Windows to LInux
But imagine its like having a canvas and anything that is outside the canvas bounds is just clipped
It does much the same in C/C++
I understand that.
I only have 32 Rows ($1F) on 4 Columns (a set of 2 x 128 information) and three buttons (Display / Copy as Text / Copy as Image).
If I have more Rows than the screen, I used a print to pdf feature instead.