Click here to Skip to main content
16,012,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to set font in notepad by using c#
Posted

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.
 
Share this answer
 
v2
Comments
kalaiking 17-Nov-11 3:29am    
i did through regedit..
LaxmikantYadav 17-Nov-11 23:46pm    
Gr8 !
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


EDIT :
To change the registry using c# see here : Read, write and delete from registry with C#[^]
 
Share this answer
 
v2
Comments
kalaiking 17-Nov-11 3:01am    
how we can set..
i need sample coding..
guide me..
kalaiking 17-Nov-11 3:07am    
you said correct.. but each and every time not possible to change by manually..
send some sample coding boss....
Mehdi Gholam 17-Nov-11 3:10am    
See the updated solution.
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
 
Share this answer
 
Comments
J.Karthick 17-Nov-11 2:16am    
well said SAKrykov :)
Mehdi Gholam 17-Nov-11 2:32am    
There is a way using the registry, see my solution.
kalaiking 17-Nov-11 3:27am    
thanks..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900