Can you be more explicit about
.... but it doesn't work in my computer at the office.
I mean , when I use the above posted codes in my laptop at home it works but when I use it at the office it doesn't change the size of the palette and it is starting expanded as in your snapshot ( expanded from bottom to top ).
Now after changing the color of the palette , the settings of the palette is enough to set the palette as per the settings without the needs of the above posted codes to re-size the palette on the fly ( on invoking/opening ).
Try to change the palette's color to any one you like , then just use the codes to load and show the palette without the codes to re-sizing on initializing.