تقسیم کردن صفحه و روی Button تصویر قرار دادن-PracticalWPFGraph

              کد زیر که با XAML نوشته شده است، یک صفحه را به 2 سطر و 2 ستون تقسیم کرده است و در هر بخش یک Button قرار داده است و در Background هر Button نیز تصویر قرار داده است:

3.  <Viewbox Stretch="Fill">

4.          <Grid>

5.              <Grid.ColumnDefinitions>

6.                  <ColumnDefinition/>

7.                  <ColumnDefinition/>

8.              </Grid.ColumnDefinitions>

9.              <Grid.RowDefinitions>

10.                <RowDefinition/>

11.                <RowDefinition/>

12.            </Grid.RowDefinitions>

13.            <StackPanel Margin="5" Grid.Column="0" Grid.Row="0">

14.                <TextBlock Margin="5,5,5,0"

15.                Text="TileMode = Tile"/>

16.                 <TextBlock Margin="5,0,5,5"

17.                 Text="Unit: Absolute"/>

18.                <Button Width="135" Height="100">

19.                 <Button.Background>

20.                     <ImageBrush ImageSource="1.jpg"

21.                        Viewport="0,0,25,25"

22.                        TileMode="Tile"

23.                        ViewportUnits="Absolute"/>

24.                 </Button.Background>

25.                </Button>

26.            </StackPanel>

27.            <StackPanel Margin="5" Grid.Column="1"

28.                Grid.Row="0">

29.                <TextBlock Margin="5,5,5,0"

30.                Text="TileMode = FlipX"/>

31.                <TextBlock Margin="5,0,5,5"

32.                Text="Unit: Absolute"/>

33.                <Button Width="135" Height="100">

34.                <Button.Background>

35.                <ImageBrush ImageSource="1.jpg"

36.                    Viewport="0,0,25,25"

37.                    TileMode="FlipX"

38.                    ViewportUnits="Absolute"/>

39.                </Button.Background>

40.                </Button>

41.            </StackPanel>

42.            <StackPanel Margin="5"

43.                Grid.Column="0" Grid.Row="1">

44.                <TextBlock Margin="5,5,5,0"

45.                Text="TileMode = FlipY"/>

46.                <TextBlock Margin="5,0,5,5"

47.                Text="Unit: Reltive"/>

48.                <Button Width="135" Height="100">

49.                <Button.Background>

50.                <ImageBrush ImageSource="1.jpg"

51.                    Viewport="0,0,0.2,0.25"

52.                    TileMode="FlipY"/>

53.                </Button.Background>

54.                </Button>

55.            </StackPanel>

56.            <StackPanel Margin="5" Grid.Column="1"

57.                Grid.Row="1">

58.                <TextBlock Margin="5,5,5,0"

59.                Text="TileMode = FlipXY"/>

60.                <TextBlock Margin="5,0,5,5"

61.                Text="Unit: Reltive"/>

62.                <Button Width="135" Height="100">

63.                 <Button.Background>

64.                    <ImageBrush ImageSource="1.jpg"

65.                    Viewport="0,0,0.2,0.25"

66.                    TileMode="FlipXY"/>

67.                </Button.Background>

68.                </Button>

69.            </StackPanel>

70.        </Grid>

71.    </Viewbox>

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد