![]() |
TMyImage von Nightshade --> Transparente Bilder??
Wie kann ich durchsichtige Bilder bei der Komponente von Nightshade realisieren??
Bisher habe ich folgendes versucht(Habe noch nie eine Komponente entwickelt, und habe daher praktisch null Ahnung):
Delphi-Quellcode:
unit MyImage;
interface uses SysUtils, Classes, Controls, ExtCtrls, Graphics, Messages; type TMyImage =class(TImage) private FOnMouseEnter: TNotifyEvent; FOnMouseLeave: TNotifyEvent; FMLPic: TPicture; FMEPic: TPicture; procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; procedure SetMEPic(const Value: TPicture); procedure SetMLPic(const Value: TPicture); protected public TransparenySec: Boolean; constructor Create(AOwner : TComponent); override; destructor Destroy; override; published property OnMouseEnter : TNotifyEvent read FOnMouseEnter Write FOnMouseEnter; property OnMouseLeave : TNotifyEvent read FOnMouseLeave Write FOnMouseLeave; property MouseEnterPicture : TPicture read FMEPic write SetMEPic; property MouseLeavePicture : TPicture read FMLPic write SetMLPic; end; procedure Register; implementation procedure Register; begin RegisterComponents('Zusätzlich', [TMyImage]); end; { TMyImage } procedure TMyImage.CMMouseEnter(var Message: TMessage); begin if Message.Msg=CM_MOUSEENTER then begin if csDesigning in ComponentState then begin if FMLPic.Bitmap <> NIL then picture.Bitmap.Assign(FMLPic.Bitmap); end else begin if FMEPic.Bitmap <> NIL then picture.Bitmap.Assign(FMEPic.Bitmap); end; if ( Assigned(FOnMouseEnter) ) then FOnMouseEnter(self); Picture.Bitmap.TransparentMode := tmFixed; Picture.Bitmap.TransparentColor := clBlack; Picture.Bitmap.Transparent := TransparenySec; repaint; end; end; procedure TMyImage.CMMouseLeave(var Message: TMessage); begin if Message.Msg=CM_MOUSELEAVE then begin if FMLPic.Bitmap <> NIL then picture.Bitmap.Assign(FMLPic.Bitmap); if ( Assigned(FOnMouseLeave) ) then FOnMouseLeave(self); repaint; end; end; constructor TMyImage.Create(AOwner: TComponent); begin inherited; FMLPic := TPicture.Create; FMEPic := TPicture.Create; end; destructor TMyImage.Destroy; begin FreeAndNil(FMLPic); FreeAndNil(FMEPic); inherited; end; procedure TMyImage.SetMEPic(const Value: TPicture); begin FMEPic.Bitmap.Assign(Value.Bitmap); end; procedure TMyImage.SetMLPic(const Value: TPicture); begin FMLPic.Bitmap.Assign(Value.Bitmap); end; end. ![]() Und nein, mit Transparency im Objektinspektor auf "True" Funktioniert es nicht! |
Re: TMyImage von Nightshade --> Transparente Bilder??
Keiner eine Idee? *Push*
|
Re: TMyImage von Nightshade --> Transparente Bilder??
*Last Time Push*
Hoffe die Mods sind mir deswegen nicht böse! |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:16 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz