Initial commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "TransparentEditUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TransparentEditUnit::TEdit::TEdit(System::Classes::TComponent* AOwner)
|
||||
: Vcl::Stdctrls::TEdit(AOwner)
|
||||
{
|
||||
ControlStyle >> csOpaque;
|
||||
FTransparent = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TransparentEditUnit::TEdit::CreateWnd(void)
|
||||
{
|
||||
Vcl::Stdctrls::TEdit::CreateWnd();
|
||||
|
||||
if( FTransparent ){
|
||||
SetWindowLong( Parent->Handle, GWL_STYLE,
|
||||
GetWindowLong(Parent->Handle, GWL_STYLE) & ~WS_CLIPCHILDREN );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TransparentEditUnit::TEdit::CreateParams(Vcl::Controls::TCreateParams &Params)
|
||||
{
|
||||
Vcl::Stdctrls::TEdit::CreateParams( Params );
|
||||
|
||||
Params.ExStyle |= WS_EX_TRANSPARENT;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TransparentEditUnit::TEdit::Invalidate()
|
||||
{
|
||||
if( FTransparent )
|
||||
SendMessage( Handle, UM_TEINVALIDATE, 0, 0 );
|
||||
else
|
||||
Vcl::Stdctrls::TEdit::Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TransparentEditUnit::TEdit::WMEraseBkgnd(TWMEraseBkgnd &Message)
|
||||
{
|
||||
if( Parent && FTransparent ){
|
||||
PostMessage( Handle, UM_TEINVALIDATE, 0, 0 );
|
||||
}
|
||||
else
|
||||
DefaultHandler( &Message );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TransparentEditUnit::TEdit::CNCtlColorEdit(TWMCtlColorEdit &Message)
|
||||
{
|
||||
if( FTransparent ){
|
||||
SetBkMode( Message.ChildDC, TRANSPARENT);
|
||||
StyleServices()->DrawParentBackground( Handle, Message.ChildDC, NULL, false);
|
||||
Message.Result = (int)GetStockObject(NULL_BRUSH);
|
||||
}
|
||||
else
|
||||
DefaultHandler( &Message );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TransparentEditUnit::TEdit::TEInvalidate(TMessage &Message)
|
||||
{
|
||||
if( Parent && FTransparent ){
|
||||
TRect r = GetClientRect();
|
||||
TPoint& pTL = r.TopLeft();
|
||||
pTL = Parent->ScreenToClient( ClientToScreen(pTL) );
|
||||
TPoint& pBR = r.BottomRight();
|
||||
pBR = Parent->ScreenToClient( ClientToScreen(pBR) );
|
||||
|
||||
RedrawWindow( ParentWindow, &r, 0, RDW_FRAME|RDW_INVALIDATE );
|
||||
}
|
||||
else
|
||||
Vcl::Stdctrls::TEdit::Invalidate();
|
||||
}
|
||||
Reference in New Issue
Block a user