Anti-Aliased Text in a Transparent .NET Form

后端 未结 2 591
孤独总比滥情好
孤独总比滥情好 2021-01-02 09:44

I have a C# application which shows the current time in a transparent .NET Form. The Form has no controls and no border. Its property TransparencyKey is set to the Form\'s

相关标签:
2条回答
  • 2021-01-02 10:08

    I asked a similar question a few months ago.

    What I ended up doing was having two options:

    1. Copy the background behind the application by setting its opacity to 0 temporarily, then draw antialiased text onto that. This approach works well if the window and those under it don't move often.
    2. Using a layered window. Works better than TransparencyKey, but still works best with non-antialiased text. (just avoid using a ClearType font and you will be fine)
    0 讨论(0)
  • 2021-01-02 10:16

    In your Display_Paint method, try this:

    this.SetStyle(ControlStyles.DoubleBuffer | 
          ControlStyles.UserPaint | 
          ControlStyles.AllPaintingInWmPaint,
          true);
    this.UpdateStyles();
    
    0 讨论(0)
提交回复
热议问题