Solved

Disable ClearType on my application

Posted on 2006-10-30
3
316 Views
Last Modified: 2009-07-16
Dear Expert,

How can I disable ClearType anti-aliasing on my application? Can this be archieved using manifest files or normal windows api? The text I don't want anti-aliased is on a label that is located on a usercontrol. The size of the font has to be small and thus the anti-aliasing messes it up.

Thank you for you fast response!
0
Comment
Question by:Noksok
  • 2
3 Comments
 

Author Comment

by:Noksok
ID: 17856077
Points raised. Urgent.
0
 

Author Comment

by:Noksok
ID: 17876937
I solved the problem by setting the global font smoothing property at the start of the program and then resetting it at the end. This is not the optimal solution but works well enough.

Here is the code for it:

-- Declares --
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

Public Const SPI_GETFONTSMOOTHING = 74
Public Const SPI_SETFONTSMOOTHING = 75
Public Const SPIF_UPDATEINIFILE = &H1
Public Const SPIF_SENDWININICHANGE = &H2

-- In the begining --
    If LenB(GetRegString(HKEY_LOCAL_MACHINE, "SOFTWARE\My program\", "FontSmoothing")) <> 2 Then
     
      SystemParametersInfo SPI_GETFONTSMOOTHING, 0, blFontSmoothing, 0
     
      If blFontSmoothing Then
        SetRegString HKEY_LOCAL_MACHINE, "SOFTWARE\My program\", "FontSmoothing", "T"
       
      Else
        SetRegString HKEY_LOCAL_MACHINE, "SOFTWARE\My program\", "FontSmoothing", "F"
       
      End If
     
    End If
   
    SystemParametersInfo SPI_SETFONTSMOOTHING, False, 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE


-- In the end of the program --
SystemParametersInfo SPI_SETFONTSMOOTHING, (GetRegString(HKEY_LOCAL_MACHINE, "Software\My program\", "FontSmoothing") = "T"), 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE

SetRegString HKEY_LOCAL_MACHINE, "SOFTWARE\My program\", "FontSmoothing", "NONE"
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 17886261
Question closed - 500 points refunded.

Best regards,
RomMod
Experts Exchange
Community Support Moderator
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question