救命呀,关于控件透明的问题 做了个透明的Panel控件,Panel控件是透明了,若在它上面放上透明的Label框,当Label里内容变化时,Label里面的内容一团糟,好像不能刷新,这是为何,请指教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Label内容赋值后再RePaint或Update一下看看怎么样 透明Panelunit TranPanel;interfaceusesWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ExtCtrls;typeTGlassStyle = (gsBlackness, gsDstInvert, gsMergeCopy, gsMergePaint, gsNotSrcCopy,gsNotSrcErase, gsPatCopy, gsPatInvert, gsPatPaint, gsSrcAnd,gsSrcCopy, gsSrcErase, gsSrcInvert, gsSrcPaint, gsWhiteness);TGlass = class(TCustomControl)privateFColor: TColor;FStyle: TGlassStyle;FOnPaint: TNotifyEvent;procedure SetColor(Value: TColor);procedure SetStyle(Value: TGlassStyle);procedure CMCtl3DChanged(var Message: TMessage); message CM_CTL3DCHANGED;procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND;procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;protectedBuffer: TBitmap;procedure CreateParams(var Params: TCreateParams); override;procedure Paint; override;procedure Resize; override;publicconstructor Create(AOwner: TComponent); override;destructor Destroy; override;property Canvas;publishedproperty Align;property Anchors;property AutoSize;property BiDiMode;property BorderWidth;property Color: TColor read FColor write SetColor;property Ctl3D;property Enabled;property Style: TGlassStyle read FStyle write SetStyle default gsSrcAnd;property Visible;property OnClick;property OnDblClick;property OnEnter;property OnExit;property OnMouseDown;property OnMouseMove;property OnMouseUp;property OnResize;property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;end;procedure Register;implementationprocedure Register;beginRegisterComponents('Croco', [TGlass]);end;function GlassStyleToInt(gs: TGlassStyle): LongInt;begincase gs ofgsBlackness : Result := cmBlackness;gsDstInvert : Result := cmDstInvert;gsMergeCopy : Result := cmMergeCopy;gsMergePaint : Result := cmMergePaint;gsNotSrcCopy : Result := cmNotSrcCopy;gsNotSrcErase: Result := cmNotSrcErase;gsPatCopy : Result := cmPatCopy;gsPatInvert : Result := cmPatInvert;gsPatPaint : Result := cmPatPaint;gsSrcAnd : Result := cmSrcAnd;gsSrcCopy : Result := cmSrcCopy;gsSrcErase : Result := cmSrcErase;gsSrcInvert : Result := cmSrcInvert;gsSrcPaint : Result := cmSrcPaint;gsWhiteness : Result := cmWhiteness;else Assert(True, 'Error parameter in function GlassStyleToInt');end;end;constructor TGlass.Create(AOwner: TComponent);begininherited Create(AOwner);Buffer := TBitmap.Create;ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents,csDoubleClicks, csReplicatable];Width := 100;Height := 100;FStyle := gsSrcAnd;ParentCtl3d := False;Ctl3D := False;ParentColor := False;FColor := clWhite;end;destructor TGlass.Destroy;beginBuffer.Free;inherited Destroy;end;procedure TGlass.Paint;varR: TRect;rop: LongInt;beginR := Rect(0, 0, Width, Height);Buffer.Width := Width;Buffer.Height := Height;Buffer.Canvas.Brush.Style := bsSolid;Buffer.Canvas.Brush.Color := FColor;Buffer.Canvas.FillRect(Rect(0, 0, Width, Height));rop := GlassStyleToInt(FStyle);StretchBlt(Buffer.Canvas.Handle, 0, 0, Width, Height,Canvas.Handle, 0, 0, Width, Height, rop);if Ctl3D then DrawEdge(Buffer.Canvas.Handle, R, BDR_RAISEDINNER, BF_RECT);Buffer.Canvas.Pen.Mode := pmCopy;Buffer.Canvas.Pen.Style := psSolid;Canvas.Draw(0, 0, Buffer);if Assigned(FOnPaint) then FOnPaint(Self);end; procedure TGlass.SetColor(Value: TColor);beginif Value <> FColor thenbeginFColor := Value;RecreateWnd;end;end;procedure TGlass.CreateParams(var Params: TCreateParams);begininherited CreateParams(Params);Params.ExStyle := Params.ExStyle + WS_EX_TRANSPARENT;end;procedure TGlass.WMWindowPosChanging(var Message: TWMWindowPosChanging);beginInvalidate;inherited;end;procedure TGlass.WMEraseBkgnd(var Message: TMessage);beginMessage.Result := 0;end;procedure TGlass.Resize;beginInvalidate;inherited;end;procedure TGlass.CMCtl3DChanged(var Message: TMessage);begininherited;RecreateWnd;end;procedure TGlass.SetStyle(Value: TGlassStyle);beginif Value <> FStyle thenbeginFStyle := Value;RecreateWnd;end;end;end. panel的代码和你的一样 jackie168(花好月圓) 你新键一个应用程序然后添加一个panel和一个edit控件加入如下代码:没有你说的问题啊。procedure TForm1.FormCreate(Sender: TObject);begin self.AlphaBlend:= true; self.AlphaBlendValue:= 150; panel1.ParentColor:= true; edit1.ParentColor:= true;end; re :weizi2000(秋风啊)没用are xixuemao(吸血猫)和你说的不一样 DELPHI求解释 怎样用indy10收gmail的邮件? 谁有往表里插入记录的例子 菜鸟求助 不好意思我把问题说具体些: 我想问一下,包一辆车把60台电脑从杭州运至四川成都要多少费用,谢谢 在MDI窗口中如何使滚动条不出现 如何实现一个同时只能执行一次的NT service程序?高手来看 (100分) 小菜问题,怎样将字符串转换成常量名 请问有一组Tlabel,如何用数组表示? realplayer控件的问题 急求高手QReport预览时如何默认为Zoom100.我弄了一个晚上了帮看看下面的代码吧! 解决后再加100分!!!
没有你说的问题啊。
procedure TForm1.FormCreate(Sender: TObject);
begin
self.AlphaBlend:= true;
self.AlphaBlendValue:= 150;
panel1.ParentColor:= true;
edit1.ParentColor:= true;
end;
没用are xixuemao(吸血猫)和你说的不一样