1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| dim Path_img = "immagine.bmp" ' ******* CHANGE NAME HERE!!! ******
frame = new wxFrame( Null, -1, "Using wxImage",wxPoint(20,20),wxSize(320,200+25))
panel = new wxPanel( frame, -1 ,wxPoint(0,200),wxSize(320,200))
panel2= new wxPanel( frame,-1,wxPoint(-1,-1),wxSize(0,0))
bmp = new wxEmptyImage(0,0) ' Create an empty Image. Size does NOT matter...
img = new wxEmptyBitmap(0,0) 'Create empty bitmap
bmp2DC = wxMemoryDC() ' Allocate memory: this space will be used to store the bitmap.
if(bmp.LoadFile(Path_img, wxBITMAP_TYPE_BMP)) then 'Load image
wxMessageBox("image loaded correctly")
end if
'resize l'immagine
wxMessageBox("Original size(X,Y) = (" & bmp.GetWidth() & "," & bmp.GetHeight() & ")")
bmp = bmp.Scale(60,60) ' Change image size
wxMessageBox("Size(X,Y) after resize = (" & bmp.GetWidth() & "," & bmp.GetHeight() & ")")
bmp2 = bmp.ConvertToBitmap() 'convert image into bmp
wxMessageBox("convert image into bitmap")
Sub onPaint( event )
dc = wxPaintDC( frame )
dc.BeginDrawing()
dc.DrawBitmap(bmp2,1,1,FALSE) 'draw converted image
dc.EndDrawing()
End Sub
Connect( frame, -1, wxEVT_PAINT, "onPaint" )
frame.Show(True) |
Partager