khchen / wNim

Nim's Windows GUI Framework
MIT License
327 stars 17 forks source link

How to resize static bitmap? #18

Closed nnahito closed 5 years ago

nnahito commented 5 years ago

When I use wNim in old version, static bitmap area could resize following code:

let frame = Frame(title="title", size=(500, 350))
frame.minSize = (280, 200)
frame.center()

let panel = Panel(frame)

var staticBitmap = StaticBitmap(panel, size=(frame.getSize()[0], frame.getSize()[1] - 30), pos=(0, 30), style=wInvisible or wSbFit or wBorderStatic)
staticBitmap.setDropTarget()
staticBitmap.show() 

proc layout() =
    panel.layout:
        staticBitmap:
            width = frame.getSize()[0]
            height = frame.getSize()[1] - 95

frame.wEvent_Size do (event: wEvent):
    layout()

However It seems impossible now. Please tell me how to resize the object like about StaticBitmap.

Thank you.

bunkford commented 5 years ago

Can you do something like this instead?

proc layout() =
    panel.layout:
        staticBitmap:
            left = panel.innerLefT
            right = panel.innerRight
            top = panel.innerTop
            bottom = panel.innerBottom - 95
nnahito commented 5 years ago

@bunkford Thank you for your reply! I try your code and it can run as expected!

Thank you!