当前位置: 首页 > news >正文

英文网站源码虚拟主机 wordpress

英文网站源码,虚拟主机 wordpress,郑州高端网站建设哪家好,wordpress简介怎么改WPF 并没有内置FontDialog和ColorDialog,但可以通过引用 Windows Forms 的控件来实现字体和颜色选择对话框功能。FontDialog 允许用户选择字体、样式、大小等设置。 添加 Windows Forms的引用 项目工程:右键“引用”》“添加引用”》勾选System.Window…

WPF 并没有内置FontDialog和ColorDialog,但可以通过引用 Windows Forms 的控件来实现字体和颜色选择对话框功能。FontDialog 允许用户选择字体、样式、大小等设置。

添加 Windows Forms的引用

  1. 项目工程:右键“引用”=》“添加引用”=》勾选System.Windows.Forms
    在这里插入图片描述
  2. 浏览选择System.Windows.Forms.dll动态库文件
    默认路径:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework
    在这里插入图片描述
    3.添加成功
    在这里插入图片描述
  • 在C# WPF应用程序中,不能直接使用System.Drawing.Font,因为System.Drawing.Font是Windows Forms的一部分,而不是WPF。WPF使用System.Windows.Media.FontFamily来表示字体。需要做相应的转换才可以使用;
  • WinForm中的Color( System.Drawing.Color)与Wpf中Color(System.Windows.Media.Color)也需要要相互转换才能使用;

代码示例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;namespace WpfColorFontDialog
{/// <summary>/// MainWindow.xaml 的交互逻辑/// </summary>public partial class MainWindow : Window{public MainWindow(){InitializeComponent();}private void btnSetFont_Click(object sender, RoutedEventArgs e){System.Windows.Forms.FontDialog fontDialog = new System.Windows.Forms.FontDialog();if (fontDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK){// System.Drawing.Font DFont = new System.Drawing.Font("宋体", 10, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic);System.Drawing.Font drawingFont = fontDialog.Font;FontFamily fontFamily = new FontFamily(drawingFont.Name);double fontSize = drawingFont.Size;FontWeight fontWeight = FontWeights.Bold;if (drawingFont.Bold){fontWeight = FontWeights.Bold;}else {fontWeight = FontWeights.Normal;}FontStyle fontStyle = (drawingFont.Style & System.Drawing.FontStyle.Italic) != 0 ? FontStyles.Italic : FontStyles.Normal;txtBlock.FontFamily = fontFamily;txtBlock.FontSize = fontSize;txtBlock.FontStyle = fontStyle;txtBlock.FontWeight = fontWeight;}}private void btnSetColor_Click(object sender, RoutedEventArgs e){System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK){System.Windows.Media.Color MColor = new System.Windows.Media.Color();MColor = System.Windows.Media.Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B);System.Windows.Media.Brush BColor = new SolidColorBrush(MColor);txtBlock.Background = BColor;}}}
}

在这里插入图片描述
在这里插入图片描述

http://www.yayakq.cn/news/569299/

相关文章:

  • 网站建设的主要工作内容企业文化ppt模板免费
  • 唐山网站建设公司印刷厂网站建设
  • 门户网站盈利模式番禺网站建设优化
  • 设计师做单页的网站生态城门户网站 建设动态
  • 长春火车站防疫要求营销型网站建设的特点表现
  • 济南建站优化购物网站html代码
  • 可以做英文教师的网站怎么建设在线视频网站
  • 地产网站模板平面设计培训班要学多久
  • 部门网站建设管理青岛网站建设免费
  • 旅游网站开发背景意义广州做大型网站建设
  • 坪山模板网站建设公司重庆模板网站建设费用
  • 网站推广的主流方法微信公众平台小程序入口
  • 泰安网站优化公司导购网站开发要多少钱
  • 我是做环保类产品注册哪些浏览量大的网站推销自己的产品比较好呢电影资源下载wordpress
  • .net 网站模板下载地址建设网站如何写文案
  • 做网站维护的人叫啥微信小程序开发平台入口
  • 商丘做网站优化的公司有哪些公众号开发教程零基础
  • 静态网站案例站长工具ip地址
  • 在湖南建设人力资源网站建设商城网站的书籍钱
  • 网站续费自己做动感地带青春卡
  • 怎么上传视频到公司网站如何做网站大图片
  • 求一个好用的网站wordpress花园月亮
  • 网站悬浮窗口大学生帮别人做网站
  • 如何给别人做网站赚钱网络建站平台
  • 网站建设 项目经验网站什么开发
  • 怎么做好网站开发_设计字节跳动现有员工人数
  • 网站开发要学什么语言上杭网站定制
  • 网站做好后怎么更新内容黄埔网站建设哪家好
  • 安溪县住房和城乡建设网站佛山大沥网站建设
  • 手机网站适配代码搜索引擎搜不到网站