The linked question addresses increasing the size of a virtual disk. Big picture, to do this, you give the VBoxManage command to increase the image size, then start the virtual machine, and use gparted or equivalent to increase the partition size.
If you want to decrease the size, you would have to reverse the steps - first shrink the partition inside the VM, then use VBoxManage to decrease the image size (assuming this is possible - I have not tried). I also do not know what would happen if you gave the VBoxManage parameters that would decrease the size of the file smaller than the partition(s) inside.
There are ways of shrinking the virtualbox file size that are not so dramatic, if that is what your end goal really is. This is called 'compacting' the drive and shrinks the virtualbox file size to only the space that is actually used.
If you plan to do any of this stuff, I strongly advise backing up any important data first.