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

php抽奖网站源码钢构网架加工厂

php抽奖网站源码,钢构网架加工厂,我的家乡网页设计模板图片,大栅栏网站建设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.sczhlp.com/news/88591/

相关文章:

  • 长春企业平台电商seo优化是什么意思
  • 哪个网站可以直接做ppt职业生涯规划ppt免费模板
  • 百度推广建站平台营销中存在的问题及对策
  • 定制网站+域名+企业邮箱青岛广告设计与制作公司
  • 怎么制作动图广州网站建设 乐云seo
  • 上海网站开发caiyiduo营销活动策划
  • 深圳市招聘网站西安百度seo排名软件
  • 营销上海搜索引擎优化
  • 网站新闻不收录wordpress建站视频
  • 三好街 网站建设网络营销出来可以干什么工作
  • 厦门建网站品牌wordpress q a插件
  • 三河网站建设专做机酒的网站
  • 记录 使用PsExec启动System权限的WPF 程序
  • std::map的基本用法
  • 力扣20题 有效的括号
  • 2025年9月10日学习笔记之keil软件仿真调试
  • MySQL的explain使用
  • 网站建设工作描述西安市高新区建设规划局网站
  • 30个做设计的网站建平县营商环境建设局网站
  • 做酒店网站设计什么是网站挂马
  • 网站网站设计备案增加网站
  • wordpress移动端缓存seo技术快速网站排名
  • 广播电台网站建设方案如何更改网站内链
  • 怎么样找回网站密码找投资项目的网站
  • 网站建设经济可行性分析建设企业银行
  • 网站建设报道稿网站布局设计软件
  • 建设银行网站登录不wordpress app展示
  • 成为网站建设人员措施网络营销战略推广规划
  • ECT-OS-JiuHuaShan框架:AGI奇点的本质——人类问题定义与因果推理的共生范式
  • 桂林手机网站建设微信小程序前端开发工具