WEB开发网
开发学院图形图像Flash 稳扎稳打Silverlight(29) - 2.0Tip/Trick之Cookie... 阅读

稳扎稳打Silverlight(29) - 2.0Tip/Trick之Cookie, 自定义字体, 为程序传递参数, 自定义鼠标右键, 程序常用配置参数

 2009-05-21 12:08:20 来源:WEB开发网   
核心提示: InitParams.xaml.csusing System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Cont

InitParams.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Silverlight20.Tip
{
    public partial class InitParams : UserControl
    {
        public InitParams()
        {
            InitializeComponent();

            this.Loaded += new RoutedEventHandler(InitParams_Loaded);
        }

        void InitParams_Loaded(object sender, RoutedEventArgs e)
        {
            // 以编码的方式读取应用程序级别的资源
            lblMsg.Text += App.Current.Resources["key1"];
        }
    }
}

4、演示如何响应并处理鼠标右键事件

为 Silverlight 插件配置参数,windowless="true"

<param name="windowless" value="true" />

RightClick.xaml

<UserControl x:Class="Silverlight20.Tip.RightClick"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Border BorderBrush="Black" BorderThickness="4" Background="Bisque" Width="100" HorizontalAlignment="Left">
       
        <!--右键菜单的内容-->
        <StackPanel>
            <TextBlock Margin="5">我是右键菜单1</TextBlock>
            <TextBlock Margin="5">我是右键菜单2</TextBlock>
            <TextBlock Margin="5">我是右键菜单3</TextBlock>
        </StackPanel>

        <!--右键菜单的位置-->
        <Border.RenderTransform>
            <TranslateTransform x:Name="tt" />
        </Border.RenderTransform>

    </Border>
</UserControl>

上一页  1 2 3 4 5 6 7  下一页

Tags:稳扎稳打 Silverlight Tip

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接