Solved

Disable ClearType on my application

Posted on 2006-10-30
3
309 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now