Answer the question
In order to leave comments, you need to log in
How to change the position of the control when dock?
P.s. There is a possibility that I didn't formulate the question correctly in the title.
There is a form that has disabled borders and, by means of the OnPaint event, its appearance of the form is rendered, including its borders and title.
The problem is that if a control is added to the form with the Dock property equal to DockStyle.Fill, the borders drawn on the form and the title overlap.
Is it possible to interfere with the behavior of the Dock, or to be more precise, to make an offset of the working area, to which it will be stretched?
Immediately I say the option "with the creation of a Panel control and scaling it with code to the desired size, and already adding all the controls to it" I don't really like it, but it works.
Further, in the course of searching on the Internet, I came across the idea "to shift the reference point of the coordinates on the form." Everything would be fine, I did it with the help of TranslateTransform, but only this shifts the reference point when drawing, but not the form itself. Consequently, the creation of the control with the indication of the zero point does not move where it should be, and the Dock property still covers everything that is possible.
Answer the question
In order to leave comments, you need to log in
If the use of DockStyle.Fill is not important, then you can do without it, just use anchors (Anchors).
With a borderless window, its client side matches the physical dimensions. When there is a border and a header, the client side is smaller. It seems that it is impossible to redefine the client part of the window with native .NET tools, but it is possible with Win32API tools. Try redefining the client side of the window with AdjustWindowRectEx .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question