0

I have a Form on which TransparencyKey = Color.Black is applied. Form contains a TextBox and it's text ForeColor is Red.

When Form transparency is active, i.e. when TransparencyKey = Color.Black text looks somehow distorted it looks like some black background elements were not removed with TransparencyKey, when form is placed on any bright (white) background.

When form is presented on dark background, everything looks ok.

I have posted a screen of my form to show you this behaviour (inserting image does not work for me right now I dunno why):

enter image description here

How to fix this so that text will be smooth as it should be independent on the background colour?

dbc
  • 104,963
  • 20
  • 228
  • 340
pitersmx
  • 935
  • 8
  • 27
  • It's a nasty side effect of composition with text antialiasing, if I remember correctly you may draw the text by yourself (if disabling antialiasing is an option) or use a _true_ transparent window. Very related: https://code.msdn.microsoft.com/windowsapps/CSWinFormLayeredWindow-23cdc375 – Adriano Repetti Sep 21 '17 at 11:27
  • Yea, when anti-aliasing is off text looks fine then... – pitersmx Sep 21 '17 at 12:18
  • Possible duplicate of [Antialiased text on transparent bitmap](https://stackoverflow.com/questions/1291061/antialiased-text-on-transparent-bitmap) – g t Sep 22 '17 at 06:20
  • I would recommend, if possible, to use WPF because it's more appropriate for this behavior and scenario you have. – Mihail Stancescu Sep 22 '17 at 07:00

0 Answers0