就是 结合 panel 和 Groupbox的特点的。

解决方案 »

  1.   

    panel BevelInner ,BevelOunter 都设为None 就ok拉?
      

  2.   

    ParentColor := True 不就可以么?
      

  3.   

    考,总算给你找着这个
    自行实现透明的控件如Panel GroupBox 
    ==========================
    言归正传,要实现一些标准的容器类控件的透明效果,也许是个经常会想到的问题。事实上在2000以上的系统下实现起来相当容易。你不需要重绘父控件的效果,一切都因为窗口有了WS_EX_TRANSPARENT的属性可以选择。下面我们就以TPanel和TGroupBox控件来说明。我们从它们继承两个新的控件,TTransPanel和TTransGroupBox。 class TTransGroupBox :public TGroupBox { void __fastcall CreateParams(Controls::TCreateParams &Params) { TGroupBox::CreateParams(Params); Params.ExStyle += WS_EX_TRANSPARENT; } void __fastcall AdjustColors(TPanelBevel Bevel,TColor& TopColor,TColor& BottomColor) { TopColor = clBtnHighlight; if (Bevel == bvLowered) TopColor = clBtnShadow; BottomColor = clBtnShadow; if (Bevel == bvLowered) BottomColor = clBtnHighlight; } void __fastcall Paint() { int H; TRect R; Longint Flags; Canvas->Font = this->Font; H = Canvas->TextHeight('0'); R = Rect(0, H / 2 - 1, Width, Height); if (Ctl3D) { R.Left ++; R.Top ++; Canvas->Brush->Color = clBtnHighlight; Canvas->FrameRect(R); OffsetRect(R, -1, -1); Canvas->Brush->Color = clBtnShadow; } else Canvas->Brush->Color = clWindowFrame; Canvas->FrameRect(R); if (Text != "") { if (!UseRightToLeftAlignment()) R = Rect(8, 0, 0, H); else R = Rect(R.Right - Canvas->TextWidth(Text) - 8, 0, 0, H); Flags = DrawTextBiDiModeFlags(DT_SINGLELINE); DrawText(Canvas->Handle, Text.c_str(), Text.Length(), &R, Flags | DT_CALCRECT); Canvas->Brush->Color = Color; Canvas->Brush->Style = bsClear; DrawText(Canvas->Handle, Text.c_str(), Text.Length(), &R, Flags); } } public: __fastcall virtual TTransGroupBox(TComponent* AOwner):TGroupBox(AOwner) { ControlStyle >> csOpaque; Width = 185; Height = 105; } };  class TTransPanel :public TPanel
    {
      void __fastcall CreateParams(Controls::TCreateParams &Params)
      {
        TPanel::CreateParams(Params);
        Params.ExStyle += WS_EX_TRANSPARENT;
      }
      void __fastcall AdjustColors(TPanelBevel Bevel,TColor& TopColor,TColor& BottomColor)
      {
        TopColor = clBtnHighlight;
        if (Bevel == bvLowered) TopColor = clBtnShadow;
        BottomColor = clBtnShadow;
        if (Bevel == bvLowered) BottomColor = clBtnHighlight;
      }
      void __fastcall Paint()
      {
        DynamicArray Alignments;
        Alignments.set_length(3);
        Alignments[taLeftJustify] = DT_LEFT;
        Alignments[taCenter] = DT_CENTER;
        Alignments[taRightJustify] = DT_RIGHT;
        TRect Rect;
        TColor TopColor, BottomColor;
        int FontHeight;
        Longint Flags;
        Rect = GetClientRect();
        if (BevelOuter != bvNone)
        {
          AdjustColors(BevelOuter,TopColor, BottomColor);
          Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
        }
        Frame3D(Canvas, Rect, Color, Color, BorderWidth);
        if (BevelInner != bvNone)
        {
          AdjustColors(BevelInner,TopColor, BottomColor);
          Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
        }
        Canvas->Brush->Color = Color;
    //    Canvas->FillRect(Rect); 注释掉这一句,就透明了。下面的bsClear保证写Caption的不使用底色。
        Canvas->Brush->Style = bsClear;
        Canvas->Font = this->Font;
        FontHeight = Canvas->TextHeight('W');    Rect.Top = ((Rect.Bottom + Rect.Top) - FontHeight) / 2;
        Rect.Bottom = Rect.Top + FontHeight;
        Flags = DT_EXPANDTABS | DT_VCENTER | Alignments[Alignment];
        Flags = DrawTextBiDiModeFlags(Flags);
        DrawText(Canvas->Handle, Caption.c_str(), -1, &Rect, Flags);
      }
    public:
      __fastcall virtual TTransPanel(TComponent* AOwner):TPanel(AOwner)
      {
        ControlStyle >> csOpaque;
        Width  = 185;
        Height = 41;
      }
    };
      

  4.   

    SUIPack控件里面有一个TsuiImagePanel不错,完全符合你的要求啊