[Gambas-devel] Transparent DrawingArea

RichardB deep_sky at ...761...
Wed Dec 21 03:08:27 CET 2016


Hi Fabien:

Thanks for your advice.  Still having problems.
I've changed my code to what you gave me:


 Private $hImage As Image

 Public Sub btnImage_Click()
    Dialog.Path = "/ home / gambas / projects / images"
    Dialog.Filter = ["Image files (* .jpg; * .jpeg; * .png; * .bmp)", "All
files( * . * )"]
    If Dialog.OpenFile() Then Return
    $hImage = New Image
    $hImage.Load(Dialog.Path)
    dwgImage.Resize($hImage.Width, $hImage.Height)
    dwgImage.Refresh
    Catch
    Message.Warning(Error.Text & "!")
End

Public Sub dwgImage_Draw()
    Draw.Begin(dwgImage)
    Draw.Fillcolor = Color.Gray
    Draw.FillStyle = Fill.Solid
    Draw.Rect(0, 0, $hImage.Width, $hImage.Height)
    Draw.Image($hImage, 0, 0)
    Draw.End
 End

Public Sub btnDraw_Click()
  dwgImage_Draw
End


Running the code will allow me to open the dialog and select a jpg. 
Stopping the code after executing the "$hImage.Load(Dialog.Path)" line shows
me that the value of Pixels for $hImage is "Out of bounds" and that the
height and width are both 0, so something is causing the image load to fail. 
The Dialog.Path is correct, showing the correct path and filename.  The
Cached property for dwgImage is True.  What am I missing?




--
View this message in context: http://gambas.8142.n7.nabble.com/Transparent-DrawingArea-tp58023p58052.html
Sent from the gambas-devel mailing list archive at Nabble.com.




More information about the Devel mailing list