一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

用WPF建的IPAD demo (內(nèi)附下載源碼)

 昵稱10504424 2013-08-22

用WPF建的IPAD demo (內(nèi)附下載源碼)

剛學(xué)WPF,然后建了一個(gè)模擬WPF的小例子,新手上路,內(nèi)容粗糙。

這是運(yùn)行后的結(jié)果。

ipad

廢話不多說(shuō),直接上源碼:

復(fù)制代碼
<Window x:Class="iPad.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:iPad"
WindowStyle="None" AllowsTransparency="True" Background="{x:Null}"
Title="{DynamicResource Title}"
FontFamily="Segoe UI"
Width="420"
Height="580"
Loaded="windowMain_Loaded" MouseLeftButtonDown="windowMain_MouseLeftButtonDown">
<Window.Resources>
<sys:String x:Key="Title">All my possessions for a moment of time.</sys:String>
<Style x:Key="PageStyle">
<Setter Property="FrameworkElement.Width" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ScrollViewAnimation}}, Path=ActualWidth}" />
<Setter Property="FrameworkElement.Height" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ScrollViewAnimation}}, Path=ActualHeight}" />
</Style>
</Window.Resources>
<Border Padding="35" Background="Black" BorderBrush="Gainsboro" BorderThickness="5" CornerRadius="10">
<Border>
<Border.Background>
<ImageBrush ImageSource="Images/iPad.png" />
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<local:ScrollViewAnimation x:Name="UIScrollView">
<StackPanel Orientation="Horizontal">
<Grid Style="{DynamicResource PageStyle}" TextBlock.FontSize="22" TextBlock.FontWeight="Bold">
<StackPanel Margin="0,10,0,0" TextBlock.Foreground="WhiteSmoke">
<TextBlock x:Name="textBlockDate" HorizontalAlignment="Center">Date</TextBlock>
<TextBlock x:Name="textBlockTime" HorizontalAlignment="Center">Time</TextBlock>
<TextBlock x:Name="textBlockWeekday" HorizontalAlignment="Center">Weekday</TextBlock>
<UniformGrid Margin="0,10,0,0" Columns="3">
<UniformGrid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Pages/UICommon.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UniformGrid.Resources>
<Image Source="Images/XML.png" />
<Image Source="Images/HTML & CSS & JavaScript.png" />
<Image Source="Images/CSharp.png" />
<Image Source="Images/Asp.Net.png" />
<Image Source="Images/WPF.png" />
<Image Source="Images/Silverlight.png" />
<Image Source="Images/WCF.png" />
<Image Source="Images/WF.png" />
<Image Source="Images/SQL Server.png" />
</UniformGrid>
</StackPanel>
</Grid>
<Grid Style="{DynamicResource PageStyle}">
<DockPanel Margin="15" LastChildFill="True">
<DockPanel DockPanel.Dock="Top">
<Button DockPanel.Dock="Right" MinWidth="40" Click="Button_Click">Go</Button>
<TextBox x:Name="textBoxUrl" />
</DockPanel>
<Frame x:Name="frameNavigate" Background="White" Opacity="0.3" />
</DockPanel>
</Grid>
<Grid Style="{DynamicResource PageStyle}">
<Image Margin="30" Source="Images/WPF.png">
<Image.Effect>
<DropShadowEffect Color="White" />
</Image.Effect>
</Image>
</Grid>
</StackPanel>
</local:ScrollViewAnimation>
<WrapPanel Grid.Row="1" Margin="0,10,0,10" HorizontalAlignment="Center" MouseLeftButtonDown="WrapPanel_MouseLeftButtonDown">
<WrapPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Pages/UICommon.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</WrapPanel.Resources>
<Ellipse x:Name="PreviewPage" />
<Ellipse x:Name="NextPage" Margin="15,0,0,0" />
</WrapPanel>
</Grid>
</Border>
</Border>
</Window>
復(fù)制代碼

 

后臺(tái)代碼:

復(fù)制代碼
/// <summary>
/// MainWindow.xaml 的交互邏輯
/// </summary>
public partial class MainWindow : Window
{
private DispatcherTimer DispatcherDateTime = new DispatcherTimer(DispatcherPriority.ApplicationIdle);
public MainWindow()
{
InitializeComponent();
}
private void windowMain_Loaded(object sender, RoutedEventArgs e)
{
DispatcherDateTime.Interval = new TimeSpan(0, 0, 1);
DispatcherDateTime.Tick += new EventHandler(UpdataDateTime);
DispatcherDateTime.Start();
}
private void windowMain_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
private void UpdataDateTime(object sender, EventArgs e)
{
textBlockDate.Text = DateTime.Now.ToString("D");
textBlockTime.Text = DateTime.Now.ToString("T");
textBlockWeekday.Text = DateTime.Now.DayOfWeek.ToString();
}
private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
switch ((e.Source as Ellipse).Name)
{
case "NextPage":
UIScrollView.ScrollNext(Orientation.Horizontal, 0.5);
break;
case "PreviewPage":
UIScrollView.ScrollPreview(Orientation.Horizontal, 0.5);
break;
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
frameNavigate.Navigate(new Uri(textBoxUrl.Text));
}
}
復(fù)制代碼

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多

    国产成人精品国产成人亚洲| 亚洲五月婷婷中文字幕| 久久人妻人人澡人人妻| 亚洲专区一区中文字幕| 欧美一区二区三区性视频 | 在线观看视频成人午夜| 国产精品成人一区二区在线| 福利在线午夜绝顶三级| 亚洲国产精品久久综合网| 在线日本不卡一区二区| 日韩精品一区二区三区四区| 成年男女午夜久久久精品| 内射精子视频欧美一区二区| 国产综合一区二区三区av| 欧美人妻盗摄日韩偷拍| 久久国产亚洲精品成人| 99精品国产自在现线观看| 91精品蜜臀一区二区三区| 亚洲黑人精品一区二区欧美| 免费人妻精品一区二区三区久久久 | 粗暴蹂躏中文一区二区三区| 国产无摭挡又爽又色又刺激| 东京不热免费观看日本| 亚洲中文字幕剧情在线播放| 日本深夜福利视频在线| 午夜日韩在线观看视频| 免费在线播放不卡视频| 麻豆果冻传媒一二三区| 99久久婷婷国产亚洲综合精品| 欧美午夜色视频国产精品| 五月婷婷综合缴情六月| 有坂深雪中文字幕亚洲中文 | 亚洲一区二区三区在线中文字幕 | 欧美亚洲综合另类色妞| 国产av一区二区三区久久不卡| 日韩人妻少妇一区二区| 欧美精品一区二区水蜜桃| 熟妇人妻av中文字幕老熟妇| 男女午夜福利院在线观看| 视频一区日韩经典中文字幕| 国产精品久久三级精品|