c# - Transparency on Windows embedded desktop -
i developing application windows embedded compact 7. 1 of requirements program round button lying on top of other controls (e.g. grid
or list
).
it seems me, not possible in .net framework, desktop icons provide transparency, on top other icons.
why , can use transparency in c# in anyway?
sorry missing information: develop in c#, .net 3.5, 2 arm processors, 500 mhz, 1 ghz, use resco components, , support transparency against background. say, system.windows.forms.control not support transparency.
just copy following code , , paste . make 1 command button or label or else. background transparent command buttons shown.
option explicit private declare function createrectrgn lib _ "gdi32" (byval x1 long, byval y1 long, _ byval x2 long, byval y2 long) long private declare function combinergn lib _ "gdi32" (byval hdestrgn long, byval hsrcrgn1 long, _ byval hsrcrgn2 long, byval ncombinemode long) long private declare function setwindowrgn lib _ "user32" (byval hwnd long, byval hrgn long, _ byval bredraw boolean) long private declare function deleteobject lib _ "gdi32" (byval hobject long) long ' constants used combinergn function private const rgn_and = 1 private const rgn_or = 2 private const rgn_xor = 3 private const rgn_diff = 4 private const rgn_copy = 5 private sub form_activate() dim rgnform long, rgncombined long dim rgncontrol long, x long dim formwidth single, formheight single dim borderwidth single, titleheight single dim ctlleft single, ctltop single dim ctlwidth single, ctlheight single dim ctl control ' calculate form area borderwidth = (me.width - me.scalewidth) / 2 titleheight = me.height - me.scaleheight - borderwidth ' convert pixels borderwidth = scalex(borderwidth, vbtwips, vbpixels) titleheight = scaley(titleheight, vbtwips, vbpixels) formwidth = scalex(me.width, vbtwips, vbpixels) formheight = scaley(me.height, vbtwips, vbpixels) ' create region whole form rgnform = createrectrgn(0, 0, formwidth, formheight) rgncombined = createrectrgn(0, 0, 0, 0) ' make graphical area transparent combining 2 regions x = combinergn(rgncombined, rgnform, rgnform, rgn_diff) ' make controls visible each ctl in controls ' make regions of controls container form visible if typeof ctl.container form ctlleft = scalex(ctl.left, vbtwips, vbpixels) + borderwidth ctltop = scalex(ctl.top, vbtwips, vbpixels) + titleheight ctlwidth = scalex(ctl.width, vbtwips, vbpixels) + ctlleft ctlheight = scalex(ctl.height, vbtwips, vbpixels) + ctltop rgncontrol = createrectrgn(ctlleft, ctltop, ctlwidth, ctlheight) x = combinergn(rgncombined, rgncombined, rgncontrol, rgn_or) end if next ctl ' set clipping area of window using resulting region setwindowrgn hwnd, rgncombined, true ' tidy x = deleteobject(rgncombined) x = deleteobject(rgncontrol) x = deleteobject(rgnform) end sub
Comments
Post a Comment