PhilDin
PhilDin

Reputation: 2842

Form layout in Visual Studio 2008 (mobile)

I'm just starting on a quick proof of concept application intended for use on Windows Mobile 6.5 devices. I'm using the Visual Studio 2008 (9.0.21022.8) form designer to create a simple GUI as per the screenshot below.

The first problem is that I can't get the GO button to be the same height as the text box to the left. Regardless of whether snap to grid is enable or disabled, when I adjust the button height, it snaps to a height that is either greater than or less than that of the text box.

The second problem is that I cannot eliminate the vertical spacing above and below the list box. I've seen mention of a "Padding" setting in various MSDN articles but this doesn't appear to be a property of the form or of any component. Another SO answer suggests setting this value under Options->Windows Forms Designer but there doesn't appear to be such an option. Am I missing something obvious or is this just more complicated than I thought?

enter image description here

Upvotes: 0

Views: 612

Answers (1)

Thorsten Dittmar
Thorsten Dittmar

Reputation: 56717

Welcome to the Compact Framework. Some things work differently here. In the "large" framework you can change the IntegralHeight property for a list box, which is not available in the Compact Framework, so the ListBox will snap to the default item height. This may cause the vertical spacing below the ListBox. The spacing above the ListBox can be eliminated either by manually setting the Top coordinate in the ListBox's properties to Top + Height of the text box.

As for the button's height: Try to set it manually in the properties. If that doesn't work I suggest you try changing the button's height to the text box height in the form's Load event.

Generally I suggest that you change the designer settings (Visual Studio settings) so that the designer doesn't show a grid, but uses the snap lines (Extras > Options > Windows Forms Designer > Layout Mode = SnapLines).

Upvotes: 1

Related Questions