
WPF
a771948524
My name is developer
展开
-
WPF 3D:使用变换中的TranslateTransform3D
程序效果: WPF 3D中的TranslateTransform3D应该是所有3D变换中最简单的变换,使用起来非常简单,先定义好3D对象,接着在适当的位置加入变换就可以了。 当然WPF 3D中变换(Transform3D类型)可以应用在如下属性中:照相机:Camera类型3D模型定义:Model3D类型容纳3D模型的Visual3D:ModelVis转载 2013-07-07 20:22:00 · 3598 阅读 · 0 评论 -
WPF 4 TextBox 笔刷特效
TextBox 控件是我们开发过程中必不可少的组件,它可以使应用程序方便的与用户进行文字交互。在新WPF 4 中又为TextBox 添加了两种新笔刷特效:Selection 、Caret ,通过这两种特效使得TextBox 更加美观。默认情况下TextBox 呈现出以下效果,字体为黑色、选区为蓝色、光标为黑色:TextBox BorderBrush="Gray" BorderThickne转载 2013-07-08 17:34:01 · 1308 阅读 · 0 评论 -
WPF ToolTip
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525">原创 2013-07-10 16:43:34 · 1134 阅读 · 0 评论 -
代码创建 WPF 旋转动画
一、WPF窗体上有一个名为rectangle2的矩形对应的XAML如下: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Wind原创 2013-07-11 20:17:00 · 1802 阅读 · 0 评论 -
在wpf datagrid中,想要根据一个条件来改变datagrid行的背景颜色
在wpf datagrid中,想要根据一个条件来改变datagrid行的背景颜色例如根据学生的年龄来修改,年龄小于18岁的,该行为红色显示,如何做到解决方法 1:在你需要加载的键入代码,我一般放在TabControl的selected事件中 Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherP转载 2013-07-12 13:05:37 · 8287 阅读 · 0 评论 -
wpf 分别用前台和后台 两种方法 绘制矩形 填充
xaml:<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Tit原创 2013-07-14 10:06:38 · 5770 阅读 · 1 评论 -
wpf 分别用 xaml 和后台代码实现 色彩渐变
xaml 方法:<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"原创 2013-07-14 09:49:45 · 4135 阅读 · 0 评论 -
wpf简单的绘图板
xaml:<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Tit原创 2013-07-14 10:36:25 · 2805 阅读 · 0 评论 -
wpf border的阴影效果
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Mai原创 2013-07-16 17:18:59 · 13281 阅读 · 1 评论 -
WPF获取外部EXE图标最简单的方法
首先在工程添加对System.Drawing的引用 创建以下方法:public static ImageSource GetIcon(string fileName){ System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(fileName); return System.Wi转载 2013-07-21 22:38:33 · 1463 阅读 · 0 评论 -
WPF使用Page创建显示不同控件的程序
1. 测试环境 WIndows XP/7 + VS20102. 操作步骤1) 创建主Window的XAML文件 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x转载 2013-07-23 21:53:31 · 1996 阅读 · 0 评论 -
wpf button style
透明的Button 图片的Button 变色的Button 样式: <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" B原创 2013-07-23 22:01:05 · 3093 阅读 · 0 评论 -
wpf 屏蔽热键
using System;using System.Windows;using System.Runtime.InteropServices;namespace WpfApplication1{ /// /// Interaction logic for App.xaml /// public partial class App : Applicati原创 2013-07-23 21:56:03 · 2882 阅读 · 1 评论 -
WPF无边框透明窗体的缩放
XAML文件源码:<Window x:Class="WpfResizeWindow.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1转载 2013-07-23 22:04:56 · 1846 阅读 · 0 评论 -
WPF: 使用Flow Document (流文档)
WPF面向的是UI展现,而文本显示无疑是UI层中的重要功能之一。WPF提供了XPS (XML 文件规范) 和Flow Document (流文档) 来在不同的场景下展现或者操作文档的显示。XPS(XML 文件规范)针对打印和面向页面的内容,而”流文档”则针对屏幕显示以及提供更动态和可以论证的更复杂模型。“流文档”几乎适用于与文本内容相关的所有方面,从产品说明到整本书籍。 Flow Do转载 2013-09-11 14:01:59 · 7153 阅读 · 0 评论 -
wpf cpu曲线图
在工作中经常会遇到需要将一组数据绘制成曲线图的情况,最简单的方法是将数据导入Excel,然后使用绘图功能手动生成曲线图。但是如果基础数据频繁更改,则手动创建图形可能会变得枯燥乏味。本篇将利用DynamicDataDisplay 在WPF 中动态模拟CPU 使用率图表,实现动态生成曲线图。 新建项目将DynamicDataDisplay.dll 加载到References 中,打开Ma转载 2013-07-08 16:59:50 · 1996 阅读 · 0 评论 -
WPF 主窗口调用UserControl
1.新建一个UserControl1.xmalxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:mc="http://schemas.openxmlformats.org/markup转载 2013-07-05 23:15:29 · 5343 阅读 · 0 评论 -
wpf无边框窗体移动和大小调整
using System;using System.Windows;using System.Windows.Interop;namespace Wpftest{ public partial class MainWindow : Window { public MainWindow() { th转载 2013-07-06 12:23:14 · 2209 阅读 · 1 评论 -
WPF读写excel的完整示例-excel文件合并工具
using System.Data;using System.Data.OleDb;using System.IO;using System.Text;using System.Windows;namespace excel文件合并工具{/// /// MainWindow.xaml 的交互逻辑/// public partial class MainW转载 2013-07-03 11:31:01 · 1738 阅读 · 0 评论 -
WPF模拟Office2010文件菜单的TabControl模板
这是Office2010中的文件菜单点开后的效果。本文我将以强大的WPF(www.itstrike.cn)来实现类似的效果。希望你能有所收获。而不是只拷贝/粘贴代码而已。开始之前。先把TabControl找个地方放着。 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="ht转载 2013-07-04 19:07:59 · 2392 阅读 · 0 评论 -
WPF 圆形Loading
原创 2013-07-08 14:54:48 · 1100 阅读 · 0 评论 -
WPF 4 动态覆盖图标(Dynamic Overlay Icon)
在《WPF 4 开发Windows 7 任务栏》一文中我们学习了任务栏的相关开发内容,同时也对覆盖图标(Overlay Icon)功能进行了一些介绍,其中覆盖图标是以静态方式呈现的。本篇将进一步制作覆盖图标的动态实例。新建应用程序在项目中添加应用程序图标资源(App.ico),通过Window 属性为应用程序设置图标。在XAML 页面添加一个“Show Overlay Ic转载 2013-07-08 16:25:50 · 2126 阅读 · 0 评论 -
Windows 7 扩展玻璃效果(Aero Glass)
Windows 7 操作系统默认具有一款玻璃效果主题(Aero Glass)。如果选择了该款主题,所有的应用程序标题栏都会处于玻璃透明效果(如下图)。这个功能是由Desktop Window Manager(DWM)服务支持的。 默认情况下,我们编写的应用程序在Windows 7 中也只有标题栏和窗口框架会具备玻璃效果,其他区域仍是不透明状态(如下图)。如果想将程序整体都改为上图I转载 2013-07-08 16:46:53 · 1509 阅读 · 0 评论 -
WPF 加载exe执行文件 | WPF c#实现窗口全屏
System.Diagnostics.Process.Start(@"文件绝对路径");原创 2013-07-05 23:12:43 · 1935 阅读 · 0 评论 -
WPF 圆角textbox
WPF 圆角textbox <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml原创 2013-07-04 19:01:24 · 2015 阅读 · 0 评论 -
将Flash 嵌入WPF 程序
由于WPF 本身中不支持COM 组件同时也无法加载ActiveX 控件,所以需要借助WinForm 引用ActiveX 控件将Flash 加入其中。首先创建一个WPF 项目(WpfFlash),将Flash 文件(.swf)加入到项目中,并将Copy to Output Directory 设置为"Copy always"。 在工程中新增一个Windows Forms Contro转载 2013-07-08 17:01:02 · 2144 阅读 · 0 评论 -
WPF连接数据库+显示数据到dataGrid
在这里我会讲述2种WPF连接到数据库的方式,也是初学WPF,希望各位别吐槽(1)WPF支持直接用ado.net ,不像silverlight那样要通过RIA或者其他方式去连接数据库所以我在这里先讲解直接用ado.net的用法首先我们要在xaml页面拖一个dataGrid的控件设置?AutoGenerateColumns="True"转载 2013-07-09 10:09:10 · 7457 阅读 · 0 评论 -
WPF中的菜单模板
资源字典代码如下:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Border Margin="2"转载 2013-07-08 14:05:01 · 1824 阅读 · 0 评论 -
WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体
运行结果: 事实上很简单,定义好一个正方体,处理好纹理。关于MeshGeometry3D的正确定义和纹理这里就不多讲了,可以参考我以前写过的一些文章:WPF 3D: MeshGeometry3D纹理坐标的正确定义WPF 3D:MeshGeometry3D的定义和光照 接下来就是怎样让它动起来。我们通过3D点动画来改变照相机(Camera类型)转载 2013-07-07 17:22:46 · 4485 阅读 · 0 评论 -
wpf XMAL中隐藏控件
首先,需要解决怎样在Click事件后设置Visibility属性?WPF中的EventSetter只能连接事件和事件处理的方法。而EventTrigger则只能定义TriggerAction,而不能添加任何SetterBase。解决方案就是用一个关键帧动画,这样可以用在EventTrigger中,接着用一个DiscreteObjectKeyFrame来设置属性值就可以了。这个关键帧的Key原创 2013-07-07 18:45:07 · 4327 阅读 · 2 评论 -
WPF 实现阴影效果
1.首先最常见的一个阴影效果的类是DropShadowEffect。它有几种比较有用的属性比如:Color设置颜色,Direction设置投影的方向,ShadowDepth设置投影距纹理下方的距离,Opacity设置透明度等等。角度的设置是这样的:下面是一个例子和效果:原创 2013-07-06 17:55:23 · 28980 阅读 · 1 评论 -
将Xaml文档转成XPS文档
// ConverterWindow.xaml xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="3转载 2013-09-13 14:32:21 · 1981 阅读 · 0 评论