稳扎稳打Silverlight(46) - 4.0UI之FlowDirection, TextTrimming, 响应鼠标滚轮事件, 响应鼠标右键事件, 全屏的新特性
稳扎稳打Silverlight(46) - 4.0UI之FlowDirection, TextTrimming, 响应鼠标滚轮事件, 响应鼠标右键事件, 全屏的新特性
2010年08月23日
稳扎稳打Silverlight(46) - 4.0UI之FlowDirection, TextTrimming, 响应鼠标滚轮事件, 响应鼠标右键事件, 全屏的新特性 收藏
稳扎稳打Silverlight(46) - 4.0UI之FlowDirection, TextTrimming, 响应鼠标滚轮事件, 响应鼠标右键事件, 全屏的新特性
作者:webabcd
介绍
Silverlight 4.0 用户界面(UI)相关:
FlowDirection - 指定文本或界面元素在它们的父元素中的流动方向
TextTrimming - 文字溢出时的显示方式
响应鼠标的滚轮事件
响应鼠标的右键事件
全屏的新特性 - 当其他程序获得焦点时,是否退出全屏模式
ComboBox 这类的控件,如果出现了垂直滚动条的话,则可以通过滚动鼠标滚轮的方法来控制该滚动条
-->
ComboBox Name="comboBox" VerticalAlignment="Top" Width="100" Height="20" MaxDropDownHeight="200" />
/*
* 本例演示如何响应鼠标滚轮事件
* UIElement.MouseWheel - 鼠标滚轮滚动时所触发的事件
* MouseWheelEventArgs.Delta - 滚轮向上滚动为正数;滚轮向下滚动为负数
*/
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;
using System.Windows.Navigation;
namespace Silverlight40.UI
{
public partial class MouseWheel : Page
{
public MouseWheel()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
List list = new List();
for (int i = 0; i
/*
* 本例演示如何响应鼠标右键事件
* UIElement.MouseRightButtonDown - 鼠标右键按下时所触发的事件
* UIElement.MouseRightButtonUp - 鼠标右键抬起时所触发的事件
*/
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;
using System.Windows.Navigation;
namespace Silverlight40.UI
{
public partial class MouseRightClick : Page
{
public MouseRightClick()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
button.MouseRightButtonDown += new MouseButtonEventHandler(button_MouseRightButtonDow n);
button.MouseRightButtonUp += new MouseButtonEventHandler(button_MouseRightButtonUp) ;
}
void button_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
lblMsg.Text = "鼠标右键 Down";
e.Handled = true;
}
void button_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
lblMsg.Text = "鼠标右键 Up";
e.Handled = true;
}
}
}
/*
* Application.Current.Host.Content.FullScreenOptions - 全屏的选项
* System.Windows.Interop.FullScreenOptions.None - 当其他程序获得焦点时,退出全屏模式(默认值)
* System.Windows.Interop.FullScreenOptions.StaysFull ScreenWhenUnfocused - 当其他程序获得焦点时,保持全屏模式
* 当设置为“StaysFullScreenWhenUnfocused”全屏时会弹出对话框,要求用户确认是否使用“StaysFullScreenWhenUnfocused”的全屏模式。如果程序是“被信任的应用程序”则不会弹出该对话框
*/
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;
using System.Windows.Navigation;
namespace Silverlight40.UI
{
public partial class FullScreen : Page
{
public FullScreen()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void btnFullScreen_Click(object sender, RoutedEventArgs e)
{
Application.Current.Host.Content.FullScreenOptions = System.Windows.Interop.FullScreenOptions.StaysFull ScreenWhenUnfocused;
Application.Current.Host.Content.IsFullScreen ^= true;
}
}
}
type="text/javascript"> if ($ != jQuery) { $ = jQuery.noConflict(); }
发表于 @ 2010年08月23日 08:02:00 |