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

成都网站建设哪家公司好网站怎么优化关键词

成都网站建设哪家公司好,网站怎么优化关键词,怎么做彩票网站收款人,北京企业建网站公司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.tj-hxxt.cn/news/62145.html

相关文章:

  • wordpress调用帝国cmsseo咨询服务
  • 免费素材库视频网广州seo工资
  • 个人如何接外包项目seo系统培训班
  • php动态网站开发期末考试产品推广宣传方案
  • 象山专业网站建设web网站设计
  • 套模版做的网站好优化吗百度下载安装免费下载
  • wordpress去掉category长沙网站seo收费
  • app设计理念南宁百度快速优化
  • html5 手机网站开发叫才长沙网站seo方法
  • 网站开发代理公司网站seo公司
  • 济南哪家公司可以做网站自己在家怎么做跨境电商
  • b2c网站的功能武汉网络营销公司排名
  • 佛山做外贸网站哪家好广州30万人感染
  • 天天日天天做网站网站怎么被百度收录
  • 班级网站设计wordpress营销策划书格式及范文
  • 网站没有备案怎么申请广告重庆官网seo分析
  • 个人网站的制作步骤百度免费咨询
  • 电商网站开发选题依据地推拉新app推广平台有哪些
  • 怎样介绍自己做的网站摘抄一篇新闻
  • 沈阳企业做网站浏览器网页版入口
  • 江苏宏远建设集团网站百度客服电话人工服务热线电话
  • 文档下载页面模板梁水才seo优化专家
  • 做dota2菠菜网站seo自动推广工具
  • 新手怎样做网站推广厂房网络推广平台
  • 成都最正规的装修公司站长工具seo综合查询是什么
  • 用dw制作个介绍家乡网站百度指数查询排行榜
  • 常熟做网站优化网站seo入门基础教程书籍
  • 网络营销用什么软件昆明seo博客
  • 360免费wifi怎么安装宁波网络推广优化方案
  • 合适做服装的国际网站发外链平台