zoukankan      html  css  js  c++  java
  • Windows Phone 7编程学习点滴二——设备方向、系统主题和系统托盘

    1 有两种方式可以改变设备的方向:

    (1) 将SupportedOrientation设置为“PortraitOrLandscape”让操作系统为你实现。

    (2) 是通过代码实现: OrientationChanged 事件。

    1 this.OrientationChanged += new EventHandler<OrientationChangedEventArgs>(MainPage_OrientationChanged);  
     1 void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e)  
     2 {  
     3             if ((e.Orientation == PageOrientation.LandscapeRight) || (e.Orientation == PageOrientation.LandscapeLeft))  
     4             {  
     5                 TitlePanel.Visibility = Visibility.Collapsed;  
     6             }  
     7             else if ((e.Orientation == PageOrientation.PortraitDown) || (e.Orientation == PageOrientation.PortraitUp))  
     8             {  
     9                 TitlePanel.Visibility = Visibility.Visible;  
    10             }  
    11         }  
    12 }  

    2 系统主题

    在Visual Studio中右击此项目,选择“Open In Expression Blend…” 或在View菜单中选择“Open In Expression Blend…”。

    在Blend的UI中有一个标签叫“Device”,看起来像这样:

    <Grid x:Name="LayoutRoot" Background="Transparent">  
    <Grid.RowDefinitions>  
    <RowDefinition Height="Auto"/>  
    <RowDefinition Height="*"/>  
    </Grid.RowDefinitions>  
    <!--TitlePanel contains the name of the application and page title-->  
    <Rectangle Stroke="Black" Grid.RowSpan="2">  
    <Rectangle.Fill>  
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">  
    <GradientStop Color="{StaticResource PhoneBackgroundColor}" Offset="0"/>  
    <GradientStop Color="{StaticResource PhoneAccentColor}" Offset="1"/>  
    </LinearGradientBrush>  
    </Rectangle.Fill>  
    </Rectangle>  
    <!--TitlePanel contains the name of the application and page title-->  
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">  
    <TextBlock x:Name="ApplicationTitle" Text="BLANKENSOFT" Style="{StaticResource PhoneTextNormalStyle}" mce_Style="{StaticResource PhoneTextNormalStyle}"/>  
    <TextBlock x:Name="PageTitle" Text="system theming" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" mce_Style="{StaticResource PhoneTextTitle1Style}">  
    <TextBlock.Foreground>  
    <SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>  
    </TextBlock.Foreground>  
    </TextBlock>  
    </StackPanel>  
    <!--ContentPanel - place additional content here-->  
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">  
    <TextBlock Height="601" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,6,0,0" x:Name="textBlock1" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mollis turpis sit amet diam elementum molestie. Cras quis massa ante. Morbi sit amet arcu quam, non dignissim nibh. Nunc lectus leo, ornare quis imperdiet id, fringilla vel diam. Proin vitae augue non sem sollicitudin imperdiet ut quis diam. Nulla vitae nulla eros. Curabitur mauris justo, eleifend eu sodales ac, blandit vitae mauris. Pellentesque erat lorem, euismod at sodales eget, sollicitudin sed velit. Praesent est sapien, hendrerit tempor tincidunt quis, posuere ac nunc. Nam odio nisl, feugiat eget blandit sit amet, dapibus id tellus. Sed blandit nisi nunc. Aliquam fermentum justo tristique risus porta sollicitudin. Aenean aliquam congue ornare. Curabitur blandit mi quis odio convallis adipiscing." VerticalAlignment="Top" Width="468" />  
    </Grid>  
    </Grid>  

    系统托盘

    shell:SystemTray.IsVisible

  • 相关阅读:
    Redis简介 安装 注册服务
    Supervisor Linux守护进程
    .Net5 控制台 读取配置文件+依赖注入
    Linux Gdip
    Net Core封装 踩坑
    Apollo 公共Namespace使用json
    Visual Studio 2019修改项目名
    【面向对象】--静态类与非静态类的区别
    win10设置默认中英文符号【程序员标配】
    MySQL 数据库访问驱动-版本问题
  • 原文地址:https://www.cnblogs.com/91program/p/5215674.html
Copyright © 2011-2022 走看看