Solved

Disable ClearType on my application

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…

895 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

14 Experts available now in Live!

Get 1:1 Help Now