How to center objects in parent with Dock Fill VB.NET - vb.net

I'm trying to make a RichTextBox have fixed size and blank space flexible (like Word, WordPad), I made this:
Set Dock to Fill
Set MaximumSize to 600,0 (0 is wildcard for sizes) (Width=600 and Height=0 -wildcard)
I got this: blank spaces are flexible and RichTextBox size is fixed, but RichTextBox is not positioned at center.
I have some options:
Set padding to auto (I suppose that it's not possible)
Set margin to auto (I suppose that it's not possible AND margins not works in winforms)
What do I have to do to position RichTextBox to center?

Use anchor instead of dock.
Dock is designed for Size, Anchor is designed for Location
Your problem is based on location, locate your box to center instead of make Dock margins.

Related

Changing button's size based on its content's length, so the button keeps its shape

I have a UIButton which is created programmatically (it can be customised from Interface Builder, though). It is a circular and it looks like this:
Now I'm working on Internationalization and I need to check it for Double-Length Pseudolanguage. The image above is taken when the app language is set to double-length pseudo, but as you can see, the button only shows one word. Here are the constraints of the button:
The title style of the button is plain, its text is centre-aligned, and the line break is set to "Word Wrap".
How to make the button keep its shape but to increase its size when needed (basically, to increase its width and height for the same amount, so it keeps being a circle), so for example, in this case to show two "Menu" words? If you know how to achieve this I would appreciate your help.
Try setting the content compression resistance on the button to required (1000) for horizontal and vertical. It will also depend on the stackViews above and below allowing for the size change.

Autolayout form login in Xcode 8

I have a problem in managing the autolayout of a form of login with these elements
Form login
The elements are an ImageView on the top, two textFields and two buttons in the middle and another button on the bottom.
Does anyone have any advice?
Connect username field to be centered horizontal in container and vertical space between UIImage and leading ,trailing constraints to the view(left and right ,give value to look similar like in photo if you dont have strict size) after just connect all other fields with username field to be equal width and height ,centered horizontal and vertical space between them.Try to make vertical space like in image ,play litle bit try diferent values that match like in form on photo.
"Continue without registration" set center horizontaly and vertical space to bottom layout (vertical space = 16 ,for example)

How to handle Segoe UI in pixel perfect layout (glyph "margin")

i am fighting with the layout of my windows store app. My problem is with the segoe ui font that I am using for the labels of some textboxes.
I have a borderless label above a textbox with a border like this:
LABEL
_____________
|__TEXTBOX___|
My problem is, that the font of the label does not align perfectly with the left border of the textbox.
First I though that it must be the label padding or something, maybe a padding or margin in the control template. But this is not the case. The true reason is the space around the glyphs within the font itself. Depending on the first letter or the size of the font the gap is bigger or smaller.
Is there a way to perfectly align the label text and the textbox independant of the first letter or the font size? Or do I really have to place every label in a different position to reduce this problem?

White square on top of the form?

I'm trying to display a white square in the upper part of a form but I have not the slightest idea how.
Like This:
Do this:
Drag a Panel control onto your form from the Containers section in your designer toolbox
Set the Dock property to Top
Resize it so it's as high as you want it
Set the backgorund color property to White
This is just one of a number of different ways that this can be accomplished. What do you plan on doing with this white area of the form?

Controls change place and form size changes

I have designed a form in VB.NET. At design time I have placed two buttons on it.
When I run it, the form size looks smaller and the buttons I have placed at the bottom are not visible. Also the alignment of the text and picture box is also different from what I set at design time.
Computer at which I am running the form is using a different resolution.
change the properties (F4) of the buttons: in ANCHOR put Bottom, Right
your buttons will be tied to the bottom and the right of the screen, instead of to the top, left, which is the default.
Grab the screen size at runtime with
Dim screen as System.Windows.Forms.Screen = System.Windows.Forms.Screen.PrimaryScreen
and using a scale factor depending on the current size (in design), scale the window to match. Check the coordinates of the buttons by hand to make sure they are not outside of the visible portion of the window.
You may not have to leave this feature in if you can debug it to the point that you know the exact resolution that you need.