我如何使用Expression Blend 4适合屏幕? [英] How can i fit to screen using Expression Blend 4?

查看:76
本文介绍了我如何使用Expression Blend 4适合屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

          我想知道它会如何 适合筛选我的应用程序。这意味着它将以任何屏幕分辨率运行。

    看看我的代码XAML:

           I want to know how it will  fit to screen my application. It means that it will run w/ any screen resolution.
     Take a look at my code XAML:

     < UserControl

    xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d =" http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable =" d"

    d:DesignHeight = QUOT; 720" d:DesignWidth = QUOT; 960"&NBSP;

    X:类= QUOT; finalFullScreenScreens.Screen_1" >

    < UserControl.Background>

    &NBSP;&NBSP;&NBSP; < ImageBrush Stretch =" Fill" />

    < /UserControl.Background>

   



    < Viewbox x:Name =" screen" Stretch =" Fill" 
    &NBSP;&NBSP;&NBSP; < Viewbox.OpacityMask>

    &NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP; < ImageBrush Stretch =" Fill" />

    &NBSP;&NBSP;&NBSP; < /Viewbox.OpacityMask>

   



    &NBSP;&NBSP;&NBSP; < Grid x:Name =" LayoutRoot"高度= QUOT; 720"宽度="960">

    &NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP; < Grid.Background>

    &NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP; < ImageBrush Stretch =" Fill" ImageSource =" /main.png" />

    &NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP; < /Grid.Background>

    &NBSP;&NBSP;&NBSP; < / Grid>

    < / Viewbox>

< / UserControl>

     <UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="720" d:DesignWidth="960" 
    x:Class="finalFullScreenScreens.Screen_1" >
    <UserControl.Background>
        <ImageBrush Stretch="Fill"/>
    </UserControl.Background>
   

    <Viewbox x:Name="screen" Stretch="Fill">
        <Viewbox.OpacityMask>
            <ImageBrush Stretch="Fill"/>
        </Viewbox.OpacityMask>
   

        <Grid x:Name="LayoutRoot" Height="720" Width="960">
            <Grid.Background>
                <ImageBrush Stretch="Fill" ImageSource="/main.png"/>
            </Grid.Background>
        </Grid>
    </Viewbox>
</UserControl>

 

   我的VB代码:

    And my VB Code:

进口系统

Imports System.Windows

Imports System.Windows.Controls

Imports System.Windows.Media

Imports System.Windows.Media.Animation

Imports System.Windows.Shapes



部分公共类Screen_1

   继承UserControl

    &NBSP;&NBSP;&NBSP; Public Sub New()

    &NBSP;&NBSP;&NBSP; '需要初始化变量

    &NBSP;&NBSP;&NBSP; InitializeComponent()

    &NBSP;&NBSP;&NBSP; AddHandler Application.Current.Host.Content.Resized,AddressOf Resized

   

   结束分

$
   Private Sub Resized(ByVal sender As Object,ByVal e As EventArgs)

  screen.Width = Application.Current.Host.Content.ActualWidth

    ; screen.Height = Application.Current.Host.Content.ActualHeight

   

  结束分

$
  



结束等级

Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes

Partial Public Class Screen_1
    Inherits UserControl
        Public Sub New()
        ' Required to initialize variables
        InitializeComponent()
        AddHandler Application.Current.Host.Content.Resized, AddressOf Resized
   
    End Sub

   Private Sub Resized(ByVal sender As Object, ByVal e As EventArgs)
 screen.Width = Application.Current.Host.Content.ActualWidth
    screen.Height = Application.Current.Host.Content.ActualHeight
   
   End Sub

  

End Class

结果 我的 代码:

Heres the result  of my  code:

&NBSP;&NBSP;&NBSP;我想知道如何使这适合屏幕。我的意思是没有垂直和水平滚动条。请你给我一些提示/代码或东西。提前致谢

    i want to know how to make this fit-to-screen. i mean no vertical and horizontal scroll bar .Will you please give me some hint/code or something. Thanks in advance

 

推荐答案

你有在Grid元素上设置明确的高度和宽度,如果删除它们并将网格设置为Horizo​​ntalAlignment = Stretch和VerticalAlignment = Stretch,您的网格将填满屏幕。

You have an explicit height and width set on your Grid element, if you remove those and set your grid to HorizontalAlignment=Stretch and VerticalAlignment=Stretch your grid will fill the screen.

 

此外,一旦你这样做,你将不需要设置高度/宽度的处理程序和代码。

Also, once you do that you won't need the handler and code that sets the heigh/width.


这篇关于我如何使用Expression Blend 4适合屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆