Solved

Disable ClearType on my application

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

860 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