如何在一张地图上标上红旗标识?

mysmile 2007-09-16 06:31:04
我有一张地图,想在需要的地方加上红旗做标识(标识的地方不限),如何实现?望高手赐教,谢谢!
...全文
1269 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
UltraBejing 2008-04-30
  • 打赏
  • 举报
回复
不知,帮顶
knowledge_Is_Life 2008-04-30
  • 打赏
  • 举报
回复
没遇到过这种情况.
mysmile 2007-10-15
  • 打赏
  • 举报
回复
谢谢 brisk_zhang 的支持,现在结贴了
立在心间 2007-09-18
  • 打赏
  • 举报
回复
forward
global type nvo_transparent from nonvisualobject
end type
type str_transobject from structure within nvo_transparent
end type
end forward

type str_transobject from structure
dragobject source
graphicobject dest
boolean get
long dc
long handle
long oldhandle
long transparentcolor
integer width
integer height
integer x
integer y
end type

global type nvo_transparent from nonvisualobject
event ue_paint ()
end type
global nvo_transparent nvo_transparent

type prototypes
public function long bitblt (long hdcdest,long xdest,long ydest,long nwidth,long nheight,long hdcsrc,long xsrc,long ysrc,long dwrop) library "gdi32" alias for "BitBlt"
public function long createbitmap (long nwidth,long nheight,long nplanes,long nbitcount,long lpbits) library "gdi32" alias for "CreateBitmap"
public function long setbkcolor (long hdc,long crcolor) library "gdi32" alias for "SetBkColor"
public function long selectobject (long hdc,long hobject) library "gdi32" alias for "SelectObject"
public function long createcompatiblebitmap (long hdc,long nwidth,long nheight) library "gdi32" alias for "CreateCompatibleBitmap"
public function long createcompatibledc (long hdc) library "gdi32" alias for "CreateCompatibleDC"
public function long deletedc (long hdc) library "gdi32" alias for "DeleteDC"
public function long deleteobject (long hobject) library "gdi32" alias for "DeleteObject"
public function long getdc (long hwnd) library "user32" alias for "GetDC"
public function integer releasedc (long hwnd,long hdc) library "user32" alias for "ReleaseDC"
end prototypes

type variables
private long srccopy = 13369376
private long notsrccopy = 3342344
private long srcand = 8913094
private long srcinvert = 6684742
private str_transobject istr_objects[]
end variables

forward prototypes
public function integer of_createtransparent (dragobject source,long transparentcolor)
public function integer of_draw (integer index)
public function integer of_release (integer index)
end prototypes

event ue_paint;integer li_i

for li_i = 1 to upperbound(istr_objects)
of_draw(li_i)
next
end event

public function integer of_createtransparent (dragobject source,long transparentcolor);integer li_i
graphicobject lgo_parent
integer li_srcwidth
integer li_srcheight
integer li_srcx
integer li_srcy
long ll_srcdc
long ll_dstdc
integer drawx
integer drawy
long ll_maskdc
long ll_invertdc
long ll_maskhandle
long ll_inverthandle
long ll_oldmaskhandle
long ll_oldinverthandle
long ll_oldbackground
long ll_mapdstdc
long ll_mapsrcdc
long ll_mapdsthandle
long ll_mapsrchandle
long ll_oldmapdsthandle
long ll_oldmapsrchandle

for li_i = 1 to upperbound(istr_objects)

if handle(istr_objects[li_i].source) = handle(source) then
return 0
end if

next

lgo_parent = source.getparent()

if not isvalid(lgo_parent) then
return -1
end if

ll_dstdc = getdc(handle(lgo_parent))
ll_srcdc = getdc(handle(source))
li_srcwidth = unitstopixels(source.width,xunitstopixels!)
li_srcheight = unitstopixels(source.height,yunitstopixels!)
drawx = unitstopixels(source.x,xunitstopixels!)
drawy = unitstopixels(source.y,yunitstopixels!)
li_srcx = 0
li_srcy = 0
ll_maskdc = createcompatibledc(ll_dstdc)
ll_maskhandle = createbitmap(li_srcwidth,li_srcheight,1,1,0)
ll_oldmaskhandle = selectobject(ll_maskdc,ll_maskhandle)
ll_invertdc = createcompatibledc(ll_dstdc)
ll_inverthandle = createbitmap(li_srcwidth,li_srcheight,1,1,0)
ll_oldinverthandle = selectobject(ll_invertdc,ll_inverthandle)
ll_oldbackground = setbkcolor(ll_srcdc,transparentcolor)
bitblt(ll_maskdc,0,0,li_srcwidth,li_srcheight,ll_srcdc,li_srcx,li_srcy,13369376)
setbkcolor(ll_srcdc,ll_oldbackground)
bitblt(ll_invertdc,0,0,li_srcwidth,li_srcheight,ll_maskdc,0,0,3342344)
ll_mapdstdc = createcompatibledc(ll_dstdc)
ll_mapdsthandle = createcompatiblebitmap(ll_dstdc,li_srcwidth,li_srcheight)
ll_oldmapdsthandle = selectobject(ll_mapdstdc,ll_mapdsthandle)
ll_mapsrcdc = createcompatibledc(ll_dstdc)
ll_mapsrchandle = createcompatiblebitmap(ll_dstdc,li_srcwidth,li_srcheight)
ll_oldmapsrchandle = selectobject(ll_mapsrcdc,ll_mapsrchandle)
bitblt(ll_mapsrcdc,0,0,li_srcwidth,li_srcheight,ll_srcdc,li_srcx,li_srcy,13369376)
bitblt(ll_mapsrcdc,0,0,li_srcwidth,li_srcheight,ll_invertdc,0,0,8913094)
source.hide()
bitblt(ll_mapdstdc,0,0,li_srcwidth,li_srcheight,ll_dstdc,drawx,drawy,13369376)
bitblt(ll_mapdstdc,0,0,li_srcwidth,li_srcheight,ll_maskdc,0,0,8913094)
bitblt(ll_mapdstdc,0,0,li_srcwidth,li_srcheight,ll_mapsrcdc,0,0,6684742)
li_i = upperbound(istr_objects) + 1
istr_objects[li_i].source = source
istr_objects[li_i].dest = lgo_parent
istr_objects[li_i].dc = ll_mapdstdc
istr_objects[li_i].handle = ll_mapdsthandle
istr_objects[li_i].oldhandle = ll_oldmapdsthandle
istr_objects[li_i].x = drawx
istr_objects[li_i].y = drawy
istr_objects[li_i].width = li_srcwidth
istr_objects[li_i].height = li_srcheight
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)
of_draw(li_i)
return 1
end function

public function integer of_draw (integer index);long ll_dc

ll_dc = getdc(handle(istr_objects[index].dest))
bitblt(ll_dc,istr_objects[index].x,istr_objects[index].y,istr_objects[index].width,istr_objects[index].height,istr_objects[index].dc,0,0,13369376)
deletedc(ll_dc)
return 1
end function

public function integer of_release (integer index);long ll_handle

ll_handle = selectobject(istr_objects[index].dc,istr_objects[index].oldhandle)
deleteobject(ll_handle)
deletedc(istr_objects[index].dc)
return 1
end function

on nvo_transparent.create
call super::create;

triggerevent("constructor")
end on

on nvo_transparent.destroy
triggerevent("destructor")
call super::destroy
end on

event destructor;integer li_i

for li_i = 1 to upperbound(istr_objects)
of_release(li_i)
next

return
end event

mysmile 2007-09-16
  • 打赏
  • 举报
回复
能否说得具体点?
balloonman2002 2007-09-16
  • 打赏
  • 举报
回复
方法一:datawindow中图片可以指定透明
方法二:api:bitblt

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧