none
Implementing IDeskBand2 causes transparent text on Vista RRS feed

  • Question

  • I have implemented a Deskband Toolbar in C# using the BandObject from http://www.codeproject.com/KB/shell/dotnetbandobjects.aspx as a base an extending it using IDeskBand2 as shown below.  However, all of my controls then become transparent as well.  I have a combobox and the text displayed it in is transparent (matches the color of the background or object behind the taskbar.  I've tried setting the backcolor property to "white" and it is still transparent.  If I set it to "Red", the backcolor of the combobox becomes a transparent read showing through the colors behind the taskbar.  This applies to the modification of the color of the text as well.

    Does anyone have any ideas why this is happening and how I might fix it?

    [ComImport, Guid("79D16DE4-ABEE-4021-8D9D-9169B261D657"), InterfaceType(ComInterfaceType.InterfaceIsDual)]
        public interface IDeskBand2
        {
            void GetBandInfo(
                UInt32 dwBandID,
                DeskBandInfoViewMode dwViewMode,
                ref DESKBANDINFO pdbi);
            //void GetBandInfo([In] int dwBandID, [In] DBIF dwViewMode, [In, Out] ref DESKBANDINFO pdbi);
            void CanRenderComposited(ref bool pfCanRenderComposited);
            void GetCompositionState(ref bool pfCompositionEnabled);
            void SetCompositionState([MarshalAs(UnmanagedType.Bool)] bool fCompositionEnabled);
        }
    
    public virtual void CanRenderComposited(ref bool pfCanRenderComposited)
            {
                pfCanRenderComposited = true;
            }
    
     public virtual void GetCompositionState(ref bool pfCompositionEnabled)
            {
                pfCompositionEnabled = this._composited;
            }
    
      public virtual void SetCompositionState(bool fCompositionEnabled)
            {
                this._composited = fCompositionEnabled;
            }
    
    
    
      public virtual void GetBandInfo(
               UInt32 dwBandID,
               DeskBandInfoViewMode dwViewMode,
               ref DESKBANDINFO dbi)
            {
    
                //            dwBandID
                //The identifier of the band. The container assigns this identifier. The band object can keep this value if it is required. 
                //dwViewMode
                //The view mode of the band object. This is one of the following values.
                //DBIF_VIEWMODE_FLOATING
                //Band object is displayed in a floating band.
                //DBIF_VIEWMODE_NORMAL
                //Band object is displayed in a horizontal band.
                //DBIF_VIEWMODE_TRANSPARENT
                //Band object is displayed in a transparent band.
                //DBIF_VIEWMODE_VERTICAL
                //Band object is displayed in a vertical band.
    
    
                if ((dbi.dwMask & DBIM.MINSIZE) != 0)
                {
                    //check this
                    if (((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) == DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) ||
                        ((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL) == DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL))
                    {
                        dbi.ptMinSize.Y = this.MinSizeVertical.Width;
                        dbi.ptMinSize.X = this.MinSizeVertical.Height;
                    }
                    else
                    {
                        dbi.ptMinSize.X = this.MinSize.Width;
                        dbi.ptMinSize.Y = this.MinSize.Height;
                    }
                }
                if ((dbi.dwMask & DBIM.MAXSIZE) != 0)
                {
                    if (((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) == DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) ||
                        ((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL) == DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL))
                    {
                        dbi.ptMaxSize.Y = this.MaxSize.Width;
                        dbi.ptMaxSize.X = this.MaxSize.Height;
                    }
                    else
                    {
                        dbi.ptMaxSize.X = this.MaxSize.Width;
                        dbi.ptMaxSize.Y = this.MaxSize.Height;
                    }
                }
                if ((dbi.dwMask & DBIM.INTEGRAL) != 0)
                {
                    if (((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) == DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) ||
                        ((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL) == DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL))
                    {
                        dbi.ptIntegral.Y = this.IntegralSize.Width;
                        dbi.ptIntegral.X = this.IntegralSize.Height;
                    }
                    else
                    {
                        dbi.ptIntegral.X = this.IntegralSize.Width;
                        dbi.ptIntegral.Y = this.IntegralSize.Height;
                    }
                }
    
                if ((dbi.dwMask & DBIM.ACTUAL) != 0)
                {
                    if (((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) == DeskBandInfoViewMode.DBIF_VIEWMODE_FLOATING) ||
                        ((dwViewMode & DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL) == DeskBandInfoViewMode.DBIF_VIEWMODE_VERTICAL))
                    {
                        dbi.ptActual.Y = this.Size.Width;
                        dbi.ptActual.X = this.Size.Height;
                    }
                    else
                    {
                        dbi.ptActual.X = this.Size.Width;
                        dbi.ptActual.Y = this.Size.Height;
                    }
                }
    
                if ((dbi.dwMask & DBIM.TITLE) != 0)
                {
                    dbi.wszTitle = this.Title;
                }
                //if ((dbi.dwMask & DBIM.MODEFLAGS) != 0)
                //{
                //    dbi.dwModeFlags = IntegralSize.Height > 0 ? DBIMF.VARIABLEHEIGHT : DBIMF.NORMAL;
                //}
                //if ((dbi.dwMask & DBIM.MODEFLAGS) != 0)
                //{
                //    dbi.dwModeFlags = DBIMF.VARIABLEHEIGHT;
                //}
                //dbi.dwModeFlags = DBIMF.ADDTOFRONT;// | DBIMF.ALWAYSGRIPPER;
                //dbi.dwModeFlags = DBIMF.ALWAYSGRIPPER;
                dbi.dwModeFlags = DBIMF.ALWAYSGRIPPER | DBIMF.VARIABLEHEIGHT;
                dbi.dwMask &= ~DBIM.BKCOLOR;
            }


    Thank you,

    John

    Monday, April 13, 2009 4:03 AM