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
  1. Home
  2. General Programming
  3. C#
  4. Transparency

Transparency

Scheduled Pinned Locked Moved C#
questionhtmlcomtutorial
10 Posts 4 Posters 0 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.
  • M Offline
    M Offline
    MrEyes
    wrote on last edited by
    #1

    I am using transparency effects to create shaped windows, I have followed the basic tutorial found here : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv\_vstechart/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.asp Now on my machine this works like a dream, but on other machines it does not work correctly - transparency doesnt work at all. All machines are set to the same resolution and colour depth (32bpp). Does anybody have any ideas on the cause of this? More info : The image in question is a 24bit bmp, the transparency key I am using is 255,0,255 (fuschia)

    P 1 Reply Last reply
    0
    • M MrEyes

      I am using transparency effects to create shaped windows, I have followed the basic tutorial found here : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv\_vstechart/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.asp Now on my machine this works like a dream, but on other machines it does not work correctly - transparency doesnt work at all. All machines are set to the same resolution and colour depth (32bpp). Does anybody have any ideas on the cause of this? More info : The image in question is a 24bit bmp, the transparency key I am using is 255,0,255 (fuschia)

      P Offline
      P Offline
      Paul Watson
      wrote on last edited by
      #2

      MrEyes wrote: Now on my machine this works like a dream, but on other machines it does not work correctly - transparency doesnt work at all. All machines are set to the same resolution and colour depth (32bpp). Are the other test machines running Windows XP? As far as I know only WXP supports transparency out of the box.

      Paul Watson
      Bluegrass
      Cape Town, South Africa

      Ray Cassick wrote:
      Well I am not female, not gay and I am not Paul Watson

      A K M 3 Replies Last reply
      0
      • P Paul Watson

        MrEyes wrote: Now on my machine this works like a dream, but on other machines it does not work correctly - transparency doesnt work at all. All machines are set to the same resolution and colour depth (32bpp). Are the other test machines running Windows XP? As far as I know only WXP supports transparency out of the box.

        Paul Watson
        Bluegrass
        Cape Town, South Africa

        Ray Cassick wrote:
        Well I am not female, not gay and I am not Paul Watson

        A Offline
        A Offline
        Andrew Lewis
        wrote on last edited by
        #3

        Windows 2000 and greater support transparency. (95/98/Me Dont) Contract Software Developer: andrew_lewis@mail.com

        P 1 Reply Last reply
        0
        • P Paul Watson

          MrEyes wrote: Now on my machine this works like a dream, but on other machines it does not work correctly - transparency doesnt work at all. All machines are set to the same resolution and colour depth (32bpp). Are the other test machines running Windows XP? As far as I know only WXP supports transparency out of the box.

          Paul Watson
          Bluegrass
          Cape Town, South Africa

          Ray Cassick wrote:
          Well I am not female, not gay and I am not Paul Watson

          K Offline
          K Offline
          Karavaev Denis
          wrote on last edited by
          #4

          Subject. ===================== http://wasp.elcat.kg

          P 1 Reply Last reply
          0
          • K Karavaev Denis

            Subject. ===================== http://wasp.elcat.kg

            P Offline
            P Offline
            Paul Watson
            wrote on last edited by
            #5

            Ahhh, thanks, my mistake :)

            Paul Watson
            Bluegrass
            Cape Town, South Africa

            Ray Cassick wrote:
            Well I am not female, not gay and I am not Paul Watson

            1 Reply Last reply
            0
            • A Andrew Lewis

              Windows 2000 and greater support transparency. (95/98/Me Dont) Contract Software Developer: andrew_lewis@mail.com

              P Offline
              P Offline
              Paul Watson
              wrote on last edited by
              #6

              Andrew Lewis wrote: Windows 2000 and greater support transparency. (95/98/Me Dont) Ahhh, thanks, my mistake :)

              Paul Watson
              Bluegrass
              Cape Town, South Africa

              Ray Cassick wrote:
              Well I am not female, not gay and I am not Paul Watson

              1 Reply Last reply
              0
              • P Paul Watson

                MrEyes wrote: Now on my machine this works like a dream, but on other machines it does not work correctly - transparency doesnt work at all. All machines are set to the same resolution and colour depth (32bpp). Are the other test machines running Windows XP? As far as I know only WXP supports transparency out of the box.

                Paul Watson
                Bluegrass
                Cape Town, South Africa

                Ray Cassick wrote:
                Well I am not female, not gay and I am not Paul Watson

                M Offline
                M Offline
                MrEyes
                wrote on last edited by
                #7

                Thanks for the replies but unfortunatly they dont bring me any closer to an answer. The following is a summary of the test machines : 1) Win 2000 (SP2) - 1024*768 - 32bit color depth 2) Win XP - 1024*768 - 32bit color depth 3) Win 2000 (SP2) - 1024*768 - 32bit color depth 4) Win XP - 1024*768 - 32bit color depth Now my form background transparency works fine on machines 1 & 2 but does not work on other two (2 & 3). I have also noticed that "opacity" works on all machines (i.e. setting the entire form to 25% opactity results in a "see through" form) I have also tried using different image formats (i.e. gif) and also different transparency colors (current using fuschia (255,0,255) all to no avail. I am 100% this is probably all being caused by some option I have missed, but if that is the case it isnt detailed in MSDN link above Once again, thanks for the replies so far, any further suggestions would be greatly appreciated PS. if anybody is interested enough, a copy of the VS .NET projects files can be found here (http://www.randomportal.com/shapedwindow.zip 256kb) - bear in mind this is a test application and is not "pretty" PPS. Alternativly the following is the source code for the form (bear in mind that the image is held with a resx resource file). This code is also autogenerated by VS .NET, so one would assume that its correct, hmmmm using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace ShapedWindow { public class Form1 : System.Windows.Forms.Form { private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage"))); this.ClientSize = new System.Drawing.Size(229, 228); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; this.TopMost = true; this.TransparencyKey = System.Drawing.Color.Fuchsia; } [STAThread] static void Main() { Application.Run(new

                P 1 Reply Last reply
                0
                • M MrEyes

                  Thanks for the replies but unfortunatly they dont bring me any closer to an answer. The following is a summary of the test machines : 1) Win 2000 (SP2) - 1024*768 - 32bit color depth 2) Win XP - 1024*768 - 32bit color depth 3) Win 2000 (SP2) - 1024*768 - 32bit color depth 4) Win XP - 1024*768 - 32bit color depth Now my form background transparency works fine on machines 1 & 2 but does not work on other two (2 & 3). I have also noticed that "opacity" works on all machines (i.e. setting the entire form to 25% opactity results in a "see through" form) I have also tried using different image formats (i.e. gif) and also different transparency colors (current using fuschia (255,0,255) all to no avail. I am 100% this is probably all being caused by some option I have missed, but if that is the case it isnt detailed in MSDN link above Once again, thanks for the replies so far, any further suggestions would be greatly appreciated PS. if anybody is interested enough, a copy of the VS .NET projects files can be found here (http://www.randomportal.com/shapedwindow.zip 256kb) - bear in mind this is a test application and is not "pretty" PPS. Alternativly the following is the source code for the form (bear in mind that the image is held with a resx resource file). This code is also autogenerated by VS .NET, so one would assume that its correct, hmmmm using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace ShapedWindow { public class Form1 : System.Windows.Forms.Form { private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage"))); this.ClientSize = new System.Drawing.Size(229, 228); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; this.TopMost = true; this.TransparencyKey = System.Drawing.Color.Fuchsia; } [STAThread] static void Main() { Application.Run(new

                  P Offline
                  P Offline
                  Paul Watson
                  wrote on last edited by
                  #8

                  MrEyes wrote: I have also noticed that "opacity" works on all machines Silly me, I thought you were talking about opacity all along. Anyway I had a look around and from what I can tell shape forms using the TransparencyKey are not reliable. Shaped Windows Forms and Controls in Visual Studio .NET[^] says "Note Monitors set to a color depth of greater than 24-bit can display problems with certain parts of the form not being transparent, despite setting of the TransparencyKey property. To avoid this problem, ensure that the monitor's color depth is set to less than 24-bit in the Display control panel. When developing applications that feature this transparency, keep in mind that you will have to make your users aware of this issue." which is pretty pathetic IMO as they offer no help or even admit there is a bug.

                  Paul Watson
                  Bluegrass
                  Cape Town, South Africa

                  Ray Cassick wrote:
                  Well I am not female, not gay and I am not Paul Watson

                  M 1 Reply Last reply
                  0
                  • P Paul Watson

                    MrEyes wrote: I have also noticed that "opacity" works on all machines Silly me, I thought you were talking about opacity all along. Anyway I had a look around and from what I can tell shape forms using the TransparencyKey are not reliable. Shaped Windows Forms and Controls in Visual Studio .NET[^] says "Note Monitors set to a color depth of greater than 24-bit can display problems with certain parts of the form not being transparent, despite setting of the TransparencyKey property. To avoid this problem, ensure that the monitor's color depth is set to less than 24-bit in the Display control panel. When developing applications that feature this transparency, keep in mind that you will have to make your users aware of this issue." which is pretty pathetic IMO as they offer no help or even admit there is a bug.

                    Paul Watson
                    Bluegrass
                    Cape Town, South Africa

                    Ray Cassick wrote:
                    Well I am not female, not gay and I am not Paul Watson

                    M Offline
                    M Offline
                    MrEyes
                    wrote on last edited by
                    #9

                    Buggary I saw that section and speed read it, assuming it was some inconsequential bug

                    M 1 Reply Last reply
                    0
                    • M MrEyes

                      Buggary I saw that section and speed read it, assuming it was some inconsequential bug

                      M Offline
                      M Offline
                      MrEyes
                      wrote on last edited by
                      #10

                      Sooooo Does anybody have any experience of using Transparent BLT in C#?

                      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