Hi all :)
After thinking and banged my head against the wall for hours, I ask a question like a true beginner in dotNet:
How do I resize an image that fit with the button?
I did this, but I'm sure it's wrong ...
try (destroydialog :: t) catch()
rollout t "Test button donet"
(
Global Sel_Bitmap
button bt "Load Image..."
dotNetControl dnc "system.windows.forms.button" width:128 height:128
on bt pressed do
(
--- set measure image to fit measure dotNetControl (I think wrong way)
Sel_Bitmap = selectbitmap()
Bitma = bitmap 128 128
local temp_new_bitmap_filename = (getDir #preview +"/Temp.bmp")
local new_bitmap = bitmap 128 128 filename:temp_new_bitmap_filename
nb = copy Sel_Bitmap new_bitmap
save new_bitmap
-- Copy the bitmap and pass it to dotNet
setClipboardBitmap new_bitmap
-- dotNet clipboard object.
local clipboardObj = dotNetClass "System.Windows.Forms.Clipboard"
-- Get the image from the clipboard into a dotNet image object.
local imgObj = clipboardObj.GetImage()
local thumb = dotNetObject "System.Drawing.Image" imgObj
dnc.image = thumb
close new_bitmap
free new_bitmap
deleteFile temp_new_bitmap_filename
clipboardObj = undefined
imgObj = undefined
gc light:true
)
--- barigazy Label Events
on dnc mouseup arg do
(
case arg.Button of
(
(arg.Button.Left): display Sel_Bitmap
)
)
)
createdialog t 200 200
Any help?
Thanks
By Michele71 · 2014-09-29
barigazy · 2014-09-29