1

いくつかのグループボックスの場所を設定しようとすると問題が発生します...

これは、デフォルト サイズのアプリケーションの写真です。

グループボックスはフォームの真ん中にあり、それが私の望みです。 ここに画像の説明を入力

これは別の写真です。アプリケーションのサイズを変更すると、

グループボックスは左側に移動され、まだ中央にはありません

グループボックスのアンカー プロパティは「右」です (すべての組み合わせを試しました)。 ここに画像の説明を入力

そして、これはアプリケーションを最大化したときの写真です。

グループボックスは右側に移動します。 ここに画像の説明を入力

サイズ変更時にグループボックスをタブページの中央に保持したい。

ここにビデオがあります: http://www.youtube.com/watch?v=itZ85hRh9dQ&feature=youtu.be

4

1 に答える 1

2

おそらく、他の解決策が見つからない場合は、form_resize イベントでそれらを置き換えることができます。グループボックスを使用したと思います...これは非常に役立ちます! 単一の GroupBoxes に対して次のようなことを行う必要があります (例では Program として):

groupBox1.Location.X = Me.Width / 2 - groupBox1.Width / 2

そして、水平方向のグループボックスを増やすには、このようなものです(ファイルとカスタマイズとして)

Dim dist As Int32 = groupBoxCustomization.Location.X - groupBoxFiles.Width + groupBoxFiles.Location.X
'Get the distance between groupBoxCustomization and groupBoxFiles
Dim groupWidth As Int32 = groupBoxCustomization.Width + groupBoxCustomization.Location.X - groupBoxFiles.Location.X
'Get the total width of the GroupBoxes including the distance between them
'Now you use the same system than before, just imagine to have only one large GroupBox
groupBoxFiles.Location.X = Me.Width / 2 - groupWidth / 2
'Now you have fixed the first GroupBox, you know the distance between the GroupBoxes, and the widths are constant, so it's easy!
groupBoxCustomization.Location.X = groupBoxFiles.Location.X + groupBoxFiles.Width + dist

計算を整数に変換する必要がある場合があります。その場合は、このコードを使用してください

intValue = CInt(double)

これが役立つことを願っています(そして機能します...私は試していません):)

于 2013-07-02T13:46:40.417 に答える