`
javababy1
  • 浏览: 1239643 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

如何在PB中实现透明DATAWINDOW?

 
阅读更多

$PBExportHeader$w_trans.srw
forward
global type w_trans from Window
end type
type p_2 from picture within w_trans
end type
type st_2 from statictext within w_trans
end type
type st_1 from statictext within w_trans
end type
type dw_2 from datawindow within w_trans
end type
type dw_1 from datawindow within w_trans
end type
type p_1 from picture within w_trans
end type
end forward

global type w_trans from Window
int X=1056
int Y=480
int Width=2574
int Height=1700
boolean TitleBar=true
string Title="透明DW测试"
long BackColor=15780518
boolean ControlMenu=true
boolean MinBox=true
boolean MaxBox=true
boolean Resizable=true
event ue_paint pbm_paint
event ue_1024 pbm_custom01
p_2 p_2
st_2 st_2
st_1 st_1
dw_2 dw_2
dw_1 dw_1
p_1 p_1
end type
global w_trans w_trans

type prototypes
function 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 prototypes
type variables

Long il_SrcDC, il_DstDC,il_MapDstDC_Old,il_MapDstHandle, il_OldMapDstHandle,il_SrcWidth,il_SrcHeight,il_color

constant long SRCCOPY = 13369376
constant long NOTSRCCOPY = 3342344
constant long SRCAND = 8913094
constant long SRCINVERT = 6684742

dragobject io_obj

long il_count

OLEObject demo
end variables
forward prototypes
public 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_oldBackGround
Long ll_MapSrcDc,ll_MapDstDC
Long ll_MapSrcHandle, ll_OldMapSrcHandle,ll_MapDstHandle,ll_OldMapDstHandle
Long 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 subroutine
public 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.create
this.p_2=create p_2
this.st_2=create st_2
this.st_1=create st_1
this.dw_2=create dw_2
this.dw_1=create dw_1
this.p_1=create p_1
this.Control[]={this.p_2,&
this.st_2,&
this.st_1,&
this.dw_2,&
this.dw_1,&
this.p_1}
end on

on w_trans.destroy
destroy(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_1
il_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 event
event 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 event
type p_2 from picture within w_trans
int X=1490
int Y=252
int Width=677
int Height=1216
string PictureName="c:\qq2000\newskins\雅典奥运\background.bmp"
boolean FocusRectangle=false
end type

type st_2 from statictext within w_trans
int X=1326
int Y=80
int Width=928
int Height=96
boolean Enabled=false
string Text="普通DW演示:"
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=15780518
int TextSize=-12
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

type st_1 from statictext within w_trans
int X=123
int Y=88
int Width=928
int Height=96
boolean Enabled=false
string Text="透明DW演示:"
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=15780518
int TextSize=-12
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

type dw_2 from datawindow within w_trans
int X=1358
int Y=336
int Width=992
int Height=1036
int TabOrder=20
boolean BringToTop=true
string DataObject="demo"
boolean Border=false
boolean HScrollBar=true
boolean VScrollBar=true
boolean LiveScroll=true
end type

type dw_1 from datawindow within w_trans
event lbuttondown pbm_lbuttondown
event lbuttonup pbm_lbuttonup
event ue_paint pbm_paint
int X=110
int Y=336
int Width=992
int Height=1036
int TabOrder=10
boolean BringToTop=true
string DataObject="demo"
boolean Border=false
boolean HScrollBar=true
boolean VScrollBar=true
boolean LiveScroll=true
end type

event ue_paint;post wf_maketrans()
end event
event rowfocuschanging;//this.visible = false
//this.visible = true
wf_maketrans()
//this.setfocus()
end event
event scrollvertical;wf_maketrans()
end event
type p_1 from picture within w_trans
int X=233
int Y=252
int Width=677
int Height=1216
string PictureName="c:\qq2000\newskins\雅典奥运\background.bmp"
boolean FocusRectangle=false
end type

分享到:
评论

相关推荐

    Pb中DataWindow的打印输出.doc

    在PowerBuilder应用开发中,DataWindow的打印输出是不可或缺的功能,尤其对于生成各种报表来说至关重要。PowerBuilder 4.0提供了丰富的内部函数,用于与打印机进行通信,支持打印DataWindow对象、字符串、位图以及...

    PB实现输入框水印效果

    在本案例中,我们将讨论如何在PowerBuilder(PB)环境中实现输入框(Text Control)的水印效果。PowerBuilder是一款强大的Windows应用程序开发工具,尤其适合构建数据库应用。 首先,我们要理解水印的基本原理。...

    pb6.5透明效果感觉效果还不错

    在PB6.5中实现透明和半透明效果,可以为用户界面(UI)增添现代感和视觉吸引力。下面我们将详细探讨如何在PB6.5中创建和管理透明效果。 首先,透明效果主要涉及到窗口对象的属性设置。在PB6.5中,我们可以使用GDI+...

    PB显示PNG图片.zip

    在PB中,我们需要确保透明像素能够正确地显示为背景色或透过其他元素。GDI+提供了解码PNG图像的Alpha通道,从而支持透明度处理。 5. **打印支持**:除了显示,描述中提到“打印直接打印即可”,这意味着实现的解决...

    pb打印(请教)

    在这个场景中,用户下载了一个关于PB打印功能的源码,但对如何理解和使用它感到困惑,因此在寻求指导。 在PowerBuilder中,打印功能通常涉及以下知识点: 1. **PowerScript**:PowerBuilder的脚本语言,用于编写...

    pb graph显示数值

    在PowerBuilder(PB)开发环境中,`pb graph显示数值`是一个关键功能,它涉及到如何在图形图表(graph)上清晰地展示数据值。这通常是为了提高数据可视化的可读性和理解性。`graph类型数据窗口改变graph类型`指的是...

    PB自定义柱状图

    在PB中,自定义柱状图是一种常见的数据可视化工具,用于展示分类数据的量级差异。柱状图可以清晰地比较不同类别之间的数量,是数据分析和报表制作中的重要元素。 创建PB自定义柱状图涉及以下几个关键知识点: 1. *...

    PB11.5 WEB客户端编程技巧总结

    PB11.5支持通过条件编译嵌入.NET代码,虽然理论上.NET能做到的PB也能实现,甚至PB独有的DataWindow功能.NET无法完全替代,但在实际应用中,嵌入.NET代码的情况并不常见。 在Web环境下,PB11.5的性能优化成为关键...

    pb powerbuilder 截图 截取图片 数据窗 截屏控制

    在这个场景中,我们关注的是PB中与截图、截取图片以及数据窗相关的知识点。 1. **数据窗口(DataWindow)**: 数据窗口是PowerBuilder中的核心组件之一,用于显示和操作数据库中的数据。它可以动态地从数据库中...

    PB9.0走马灯

    PB9.0支持数据窗口(DataWindow)技术,可以方便地将数据绑定到界面元素,实现数据与界面的同步更新。 4. **动画效果**:为了实现走马灯的平滑过渡,开发者需要运用动画技术,这可能涉及到调整控件的位置、大小、...

    pb数据窗口打印实现签名或签章

    在PowerBuilder(PB)开发中,数据窗口(DataWindow)是一个强大的组件,用于展示和操作数据库中的数据。在某些业务场景下,用户可能需要在打印数据窗口时添加签名或签章,以确认或验证信息。然而,传统的文本框或...

    Pb分布式开发简明教程

    2. **远程数据对象(RDO)**:RDO是PB中用于处理分布式数据的关键技术,它使得应用程序能够透明地访问远程数据源,而无需关心底层网络细节。 3. **Web服务**:PB11.5支持创建和消费Web服务,这对于构建分布式系统至...

    PowerBuilder窗口上对象透明实例

    3. **数据窗口透明**:PowerBuilder的数据窗口(DataWindow)对象也可以实现透明。通过设置数据窗口的透明属性,我们可以让数据窗口背后的窗口内容可见。这在创建复杂的用户界面时非常有用。 4. **事件驱动透明**:...

    PB编的电脑抽奖程序

    在PB中,可以使用内置的数学函数或自定义函数来实现这一功能,确保每次抽奖的结果是不可预测的。 4. 实时反馈:抽奖过程中,程序需要实时显示当前的抽奖状态,例如正在抽取的号码、剩余未抽取的名额等,PB可以通过...

    PB11.5_WEB客户端编程技巧

    标题中的“PB11.5_WEB客户端编程技巧”意味着本知识点将围绕PB11.5版本中的WEB开发技术进行展开,重点介绍如何在PowerBuilder(PB)这一开发平台上实现客户端编程,并提供了一系列技巧和方法来优化WEB应用程序的性能...

    PB报表自定义系统.zip_PB 报表源码_PB报表_pb报表自定义_pb自定义_报表系统

    PB内置的DataWindow对象可以方便地创建各种复杂格式的报表,包括表格、图表、交叉表等,同时支持多种数据格式和输出方式,如打印、导出PDF或Excel。 3. **PB报表自定义**:PB报表自定义允许用户根据业务需求调整...

    pb11的漂亮界面和源码

    在本主题“pb11的漂亮界面和源码”中,我们将深入探讨PB11如何通过其先进的图形用户界面(GUI)设计功能以及提供源码的优势,帮助开发者构建美观且高效的软件应用。 首先,让我们关注PB11的界面设计。在GUI开发领域...

    PB 数据窗口(控件、窗口)截图、见见画线、类似QQ截图

    在PowerBuilder(PB)开发环境中,数据窗口(DataWindow)是一个强大的组件,用于展示和操作数据库中的数据。在这个场景中,我们关注的是一个特定的功能增强,即“数据窗口图片控件自由截图,可见画笔线,类似QQ截图...

    PB进阶代码(很全的)

    7.2.4 PB中实现图形的复制与粘贴以及图像的简单处理 -- PictureBox 7.3.1 获得系统的内部进程 -- System Thread 7.3.2 获得系统基本信息 -- SystemInformation 7.4.1 检测物理网络的连通情况 -- Mping 7.4.2 ...

    PB与各种数据库连接

    除了上述方法外,PB还提供了数据窗口(DataWindow)组件,它能够透明地处理数据库查询、更新和事务处理,极大地简化了数据库操作。通过数据窗口,开发者可以构建用户界面,同时处理复杂的SQL语句,无需直接操作SQLCA...

Global site tag (gtag.js) - Google Analytics