[ vb 2008 ] 윈도우폼 사이즈변경 예제 본문

[PL]/VB & VB.NET

[ vb 2008 ] 윈도우폼 사이즈변경 예제

객과 함께. 2010. 1. 3. 16:01

Imports System.Windows

Class Window1

    Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        Call winFormSetting()
    End Sub

    Private Sub winFormSetting()

        Me.Title = "폼 사이즈"
        Button1.Content = "확  인"
        Label1.Content = ""
        Label2.Content = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click

        Dim We As Single
        Dim He As Single

        We = Window1.Width
        He = Window1.Height

        Label1.Content = "Width : " & We
        Label2.Content = "Height : " & He
    End Sub
End Class


XAML Source :
<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" Name="Window1">
    <Grid>
        <Grid Margin="-1,0,0,0" Name="Grid1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="93*" />
                <ColumnDefinition Width="93*" />
                <ColumnDefinition Width="93*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="98*" />
                <RowDefinition Height="38*" />
                <RowDefinition Height="40*" />
                <RowDefinition Height="61*" />
                <RowDefinition Height="25*" />
            </Grid.RowDefinitions>
            <Button Grid.Column="1" Grid.Row="4" Name="Button1">Button</Button>
            <Label Margin="0,3,0,2" Name="Label1" HorizontalContentAlignment="Center" Grid.Row="1" Grid.Column="1" FontSize="15">Label</Label>
            <Label Margin="0,4,0,3" Name="Label2" HorizontalContentAlignment="Center" Foreground="Black" Grid.Row="2" Grid.Column="1" FontSize="15">Label</Label>
        </Grid>
    </Grid>
</Window>

 

 

 

 

WPF 폼사이즈변경예제.zip
0.12MB