如何使用C#在记事本中设置字体 [英] how to set font in notepad by using c#

查看:616
本文介绍了如何使用C#在记事本中设置字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#

推荐答案

在记事本中设置字体您可以使用以下注册表项在记事本中更改默认字体(这将设置为"Courier New ,大小为9):
You can change the default font in notepad with the following registry keys (this will set to "Courier New" and size of 9):
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"lfEscapement"=dword:00000000
"lfOrientation"=dword:00000000
"lfWeight"=dword:00000190
"lfItalic"=dword:00000000
"lfUnderline"=dword:00000000
"lfStrikeOut"=dword:00000000
"lfCharSet"=dword:000000b2
"lfOutPrecision"=dword:00000003
"lfClipPrecision"=dword:00000002
"lfQuality"=dword:00000001
"lfPitchAndFamily"=dword:00000031
"lfFaceName"="Courier New"
"iPointSize"=dword:0000005a




要使用c#更改注册表,请参见此处:使用C#从注册表中读取,写入和删除 [ ^ ]



EDIT :
To change the registry using c# see here : Read, write and delete from registry with C#[^]


您没有访问Microsoft记事本的权限,这是一个专有的隔离封闭源代码不好的应用程序.编写您自己的编辑器;那么字体就不会有问题.
另外,谁需要记事本?这是一种基本语言,功能低于最低要求.如果正确实现,即使是基于TextBox控件之一(WPF或Forms)的最简单的自制编辑器,也会做得更好.

—SA
You don''t have access to Microsoft Notepad, this is a proprietary isolated closed-source no-good application. Write you own editor; then the font won''t be a problem.
Also, who needs Notepad? This a rudimentary language with feature below minimalistic requirements. Even the simplest home-made editor based on one of the TextBox controls (WPF or Forms) will do much better if implemented accurately.

—SA


为此,您必须使用窗口挂钩".要在C#中使用winddow挂钩,您必须在PInvoke的帮助下使用Win32 Api.
For that you have to use Window Hooking. To use winddow hook in C# you have to use Win32 Api''s with the help of PInvoke.


这篇关于如何使用C#在记事本中设置字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆