Constant UI elements size

Hello, I am new in unity. Now I want to create UI for my task, but I have a problem with scaling, so my question is how I can provide a constant element (buttons, drop-down lists, etc.) size, which depends on DPI. For example, now, when I try to resize my window, the elements are also resized too. I also want to provide resizing of elements from the script. So what is the best way to solve this problem?

If you click on a GUI object with the tool that you are using in the picture above you should see the ancor points, just drag them to fit the elemnt size and it will remain that on all the resolutions ;D
YOU CANT DO THIS TRICK WITH SLIDERS HANDLE OR LAYOUT GROUPS.

To make a UI element independent of the size of the screen:
_

  1. Select the UI element.

  2. Set the required Anchor Preset (the ones I highlighted will work in your case):
    181957-anchorpresets.png