$PBExportHeader$w_trans.srwforwardglobal type w_trans from Windowend typetype p_2 from picture within w_transend typetype st_2 from statictext within w_transend typetype st_1 from statictext within w_transend typetype dw_2 from datawindow within w_transend typetype dw_1 from datawindow within w_transend typetype p_1 from picture within w_transend typeend forward
global type w_trans from Windowint X=1056int Y=480int Width=2574int Height=1700boolean TitleBar=truestring Title="透明DW测试"long BackColor=15780518boolean ControlMenu=trueboolean MinBox=trueboolean MaxBox=trueboolean Resizable=trueevent ue_paint pbm_paintevent ue_1024 pbm_custom01p_2 p_2st_2 st_2st_1 st_1dw_2 dw_2dw_1 dw_1p_1 p_1end typeglobal w_trans w_trans
type prototypesfunction long BitBlt ( long hdcdest, long xdest, long ydest, long nwidth,long nheight,long hdcsrc, long xsrc, long ysrc, long dwrop ) library "gdi32"function long CreateBitmap ( long nwidth, long nheight, long nplanes, long nbitcount, long lpbits ) library "gdi32"function long SetBkColor ( long hdc, long crcolor ) library "gdi32"function long SelectObject ( long hdc, long hobject ) library "gdi32"function long CreateCompatibleBitmap ( long hdc, long nwidth, long nheight ) library "gdi32"function long CreateCompatibleDC ( long hdc ) library "gdi32"function long DeleteDC ( long hdc ) library "gdi32"function long DeleteObject ( long hobject ) library "gdi32"function long GetDC ( long hwnd ) library "user32"function Integer ReleaseDC ( long hwnd, long hdc ) library "user32"
end prototypestype variables
Long il_SrcDC, il_DstDC,il_MapDstDC_Old,il_MapDstHandle, il_OldMapDstHandle,il_SrcWidth,il_SrcHeight,il_color
constant long SRCCOPY = 13369376constant long NOTSRCCOPY = 3342344constant long SRCAND = 8913094constant long SRCINVERT = 6684742
dragobject io_obj
long il_count
OLEObject demoend variablesforward prototypespublic subroutine wf_maketrans ()public subroutine wf_makedc ()public subroutine wf_maketrans ()public subroutine wf_makedc ()end prototypes
event ue_paint;//post wf_formbak()end event
event ue_1024;messagebox("demo","demo")end event
public subroutine wf_maketrans ();long ll_oldBackGroundLong ll_MapSrcDc,ll_MapDstDCLong ll_MapSrcHandle, ll_OldMapSrcHandle,ll_MapDstHandle,ll_OldMapDstHandleLong ll_maskDC, ll_InvertDC, ll_maskHandle, ll_InvertHandle, ll_oldMaskHandle, ll_OldInvertHandle
ll_maskDc = CreateCompatibleDC(il_SrcDC)ll_maskHandle = CreateBitmap(il_SrcWidth, il_SrcHeight, 1, 1, 0)ll_OldMaskHandle = SelectObject(ll_MaskDC, ll_MaskHandle)
ll_InvertDC = CreateCompatibleDC(ll_maskDc)ll_InvertHandle = CreateBitmap(il_SrcWidth, il_SrcHeight, 1, 1, 0)ll_OldInvertHandle = SelectObject(ll_InvertDC, ll_InvertHandle)
ll_oldBackGround = SetBkColor(il_SrcDC, il_color)BitBlt(ll_maskDc, 0, 0, il_SrcWidth, il_SrcHeight, il_SrcDC, 0, 0, SRCCOPY)SetBkColor(il_SrcDC, ll_oldBackGround)
BitBlt( ll_invertDC, 0, 0,il_SrcWidth, il_SrcHeight, ll_maskDC, 0, 0, NOTSRCCOPY) ll_MapDstDC = CreateCompatibleDC(il_mapdstdc_old)ll_MapDstHandle = CreateCompatibleBitmap(il_mapdstdc_old, il_SrcWidth, il_SrcHeight)ll_OldMapDstHandle = SelectObject(ll_MapDstDC, ll_MapDstHandle)
ll_MapSrcDC = CreateCompatibleDC(il_SrcDC)ll_MapSrcHandle = CreateCompatibleBitmap(il_SrcDC, il_SrcWidth, il_SrcHeight)ll_OldMapSrcHandle = SelectObject(ll_MapSrcDC, ll_MapSrcHandle)
BitBlt(ll_MapSrcDC, 0, 0, il_SrcWidth, il_SrcHeight, il_SrcDC, 0, 0, SRCCOPY)
BitBlt(ll_MapSrcDc, 0, 0, il_SrcWidth, il_SrcHeight, ll_InvertDC, 0, 0, SRCAND)
BitBlt(ll_MapDstDC, 0, 0, il_SrcWidth, il_SrcHeight, il_MapDstDC_Old, 0,0, SRCCOPY)
BitBlt(ll_MapDstDC, 0, 0, il_SrcWidth, il_SrcHeight, ll_MaskDC, 0, 0 ,SRCAND)
BitBlt(ll_MapDstDC, 0, 0, il_SrcWidth, il_SrcHeight, ll_MapSrcDC, 0 ,0 , SRCINVERT)
BitBlt(il_SrcDC,0,0,il_SrcWidth,il_SrcHeight,ll_MapDstDC,0,0, SRCCOPY)
ll_MaskHandle = SelectObject(ll_MaskDC, ll_OldMaskHandle)DeleteObject(ll_MaskHandle)DeleteDC(ll_MaskDC)
ll_Inverthandle = SelectObject(ll_InvertDC, ll_OldInvertHandle)DeleteObject(ll_InvertHandle)DeleteDC(ll_InvertDC)
ll_MapSrcHandle = SelectObject(ll_MapSrcDC, ll_OldMapSrcHandle)DeleteObject(ll_MapSrchandle)DeleteDC(ll_MapSrcDC)
ll_MapDstHandle = SelectObject(ll_MapDstDC, ll_OldMapDstHandle)DeleteObject(ll_MapDsthandle)DeleteDC(ll_MapDstDC)end subroutinepublic subroutine wf_makedc ();Integer DRAWX, DRAWY
il_SrcWidth = UnitsToPixels(io_obj.Width, XUnitsToPixels!)il_SrcHeight = UnitsToPixels(io_obj.Height, YUnitsToPixels!)
DRAWX = UnitsToPixels(io_obj.X, XUnitsToPixels!)DRAWY = UnitsToPixels(io_obj.Y, YUnitsToPixels!)
il_MapDstDC_Old = CreateCompatibleDC(il_DstDC)il_MapDstHandle = CreateCompatibleBitmap(il_DstDC, il_SrcWidth, il_SrcHeight)il_OldMapDstHandle = SelectObject(il_MapDstDC_Old, il_MapDstHandle)
io_obj.Hide()
p_1.setredraw(true)
BitBlt(il_MapDstDC_Old, 0, 0, il_SrcWidth, il_SrcHeight, il_DstDC, DRAWX, DRAWY, SRCCOPY)
io_obj.show()end subroutine
on w_trans.createthis.p_2=create p_2this.st_2=create st_2this.st_1=create st_1this.dw_2=create dw_2this.dw_1=create dw_1this.p_1=create p_1this.Control[]={this.p_2,&this.st_2,&this.st_1,&this.dw_2,&this.dw_1,&this.p_1}end on
on w_trans.destroydestroy(this.p_2)destroy(this.st_2)destroy(this.st_1)destroy(this.dw_2)destroy(this.dw_1)destroy(this.p_1)end on
event open;io_obj = dw_1il_color = rgb(255,255,255)
il_DstDC = GetDC(Handle(io_obj.Getparent()))il_SrcDC = GetDC(Handle(io_obj))
dw_1.insertrow(0)dw_2.insertrow(0)
post wf_makedc()end eventevent close;ReleaseDC(handle(this),il_DstDC)ReleaseDC(handle(this),il_SrcDC)
il_MapDstHandle = SelectObject(il_MapDstDC_Old, il_OldMapDstHandle)DeleteObject(il_MapDstHandle)DeleteDC(il_MapDstDC_Old)
end eventtype p_2 from picture within w_transint X=1490int Y=252int Width=677int Height=1216string PictureName="c:/qq2000/newskins/雅典奥运/background.bmp"boolean FocusRectangle=falseend type
type st_2 from statictext within w_transint X=1326int Y=80int Width=928int Height=96boolean Enabled=falsestring Text="普通DW演示:"boolean FocusRectangle=falselong TextColor=33554432long BackColor=15780518int TextSize=-12int Weight=400string FaceName="Arial"FontCharSet FontCharSet=Ansi!FontFamily FontFamily=Swiss!FontPitch FontPitch=Variable!end type
type st_1 from statictext within w_transint X=123int Y=88int Width=928int Height=96boolean Enabled=falsestring Text="透明DW演示:"boolean FocusRectangle=falselong TextColor=33554432long BackColor=15780518int TextSize=-12int Weight=400string FaceName="Arial"FontCharSet FontCharSet=Ansi!FontFamily FontFamily=Swiss!FontPitch FontPitch=Variable!end type
type dw_2 from datawindow within w_transint X=1358int Y=336int Width=992int Height=1036int TabOrder=20boolean BringToTop=truestring DataObject="demo"boolean Border=falseboolean HScrollBar=trueboolean VScrollBar=trueboolean LiveScroll=trueend type
type dw_1 from datawindow within w_transevent lbuttondown pbm_lbuttondownevent lbuttonup pbm_lbuttonupevent ue_paint pbm_paintint X=110int Y=336int Width=992int Height=1036int TabOrder=10boolean BringToTop=truestring DataObject="demo"boolean Border=falseboolean HScrollBar=trueboolean VScrollBar=trueboolean LiveScroll=trueend type
event ue_paint;post wf_maketrans()end eventevent rowfocuschanging;//this.visible = false//this.visible = truewf_maketrans()//this.setfocus()end eventevent scrollvertical;wf_maketrans()end eventtype p_1 from picture within w_transint X=233int Y=252int Width=677int Height=1216string PictureName="c:/qq2000/newskins/雅典奥运/background.bmp"boolean FocusRectangle=falseend type