Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. TransparencyKey not working correctly

TransparencyKey not working correctly

Scheduled Pinned Locked Moved C#
questionhelp
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 3 Offline
    3 Offline
    3Dizard
    wrote on last edited by
    #1

    Asked that question before, but didn't get an answer to my question. My problem is the following: I'd like to make my standard Form completely transparent. To do that I set TransparencyKey property to BackColor: private void Form1_Load(object sender, System.EventArgs e) { this.TransparencyKey = this.BackColor; } This way the form in fact becomes transparent, but when it is shown, there is a short black flicker until the background gets transparent. A way I figuered out to get rid of that is to set the BackColor to pure black, too: this.BackColor = Color.Black; But this is no satisfying solution. To figure out what was going on I replaced the OnPaintBackground function with my own one, which simply does nothing: protected override void OnPaintBackground(PaintEventArgs e) { //empty } The result is a black background. This background doesn't appear when BackColor is set to black as mentioned above. Does this happen on your machines, too? Thanks, 3Dizard

    S L 2 Replies Last reply
    0
    • 3 3Dizard

      Asked that question before, but didn't get an answer to my question. My problem is the following: I'd like to make my standard Form completely transparent. To do that I set TransparencyKey property to BackColor: private void Form1_Load(object sender, System.EventArgs e) { this.TransparencyKey = this.BackColor; } This way the form in fact becomes transparent, but when it is shown, there is a short black flicker until the background gets transparent. A way I figuered out to get rid of that is to set the BackColor to pure black, too: this.BackColor = Color.Black; But this is no satisfying solution. To figure out what was going on I replaced the OnPaintBackground function with my own one, which simply does nothing: protected override void OnPaintBackground(PaintEventArgs e) { //empty } The result is a black background. This background doesn't appear when BackColor is set to black as mentioned above. Does this happen on your machines, too? Thanks, 3Dizard

      S Offline
      S Offline
      Stanciu Vlad
      wrote on last edited by
      #2

      3Dizard wrote: This way the form in fact becomes transparent, but when it is shown, there is a short black flicker until the background gets transparent. I noticed that to, and I haven't figured out why. But this "problem" appears at the first call, so if you change the opacity or the transparency key the second time it doesn't acts like the first one. I hope you understand...

      1 Reply Last reply
      0
      • 3 3Dizard

        Asked that question before, but didn't get an answer to my question. My problem is the following: I'd like to make my standard Form completely transparent. To do that I set TransparencyKey property to BackColor: private void Form1_Load(object sender, System.EventArgs e) { this.TransparencyKey = this.BackColor; } This way the form in fact becomes transparent, but when it is shown, there is a short black flicker until the background gets transparent. A way I figuered out to get rid of that is to set the BackColor to pure black, too: this.BackColor = Color.Black; But this is no satisfying solution. To figure out what was going on I replaced the OnPaintBackground function with my own one, which simply does nothing: protected override void OnPaintBackground(PaintEventArgs e) { //empty } The result is a black background. This background doesn't appear when BackColor is set to black as mentioned above. Does this happen on your machines, too? Thanks, 3Dizard

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Look at Control.SetStyle() and specifically ControlStyles.SupportsTransparentBackColor top secret xacc-ide 0.0.1

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups