winforms - transparent background in Windows Forms? -
i transparent red color form background of vb6 program
i use code transparent background of from
option explicit private const gwl_exstyle long = (-20) private const lwa_colorkey long = &h1 private const lwa_defaut long = &h2 private const ws_ex_layered long = &h80000 private declare function getwindowlong lib "user32" alias _ "getwindowlonga" (byval hwnd long, byval nindex long) long private declare function setwindowlong lib "user32" alias _ "setwindowlonga" (byval hwnd long, byval nindex long, _ byval dwnewlong long) long private declare function setlayeredwindowattributes lib "user32" _ (byval hwnd long, byval crkey long, byval bdefaut byte, _ byval dwflags long) long ___________________________________________________________________________ private sub form_load() me.backcolor = rgb(254,0,0) transparency me.hwnd, me.backcolor, 255 end sub ___________________________________________________________________________ private sub transparency(byval hwnd long, byval lngtransparentcolor long, _ byval byttransparency byte) dim lngwindowstyle long lngwindowstyle = getwindowlong(hwnd, gwl_exstyle) if (lngwindowstyle , ws_ex_layered) <> ws_ex_layered setwindowlong hwnd, gwl_exstyle, lngwindowstyle or ws_ex_layered end if setlayeredwindowattributes hwnd, lngtransparentcolor, byttransparency, _ lwa_colorkey or lwa_defaut end sub
but can see in picture red
noise remains
how can remove noise?
i save picture .png
, use alphaimagecontrol.ocx
show it
red noise removed red line under form remains
as commenters said, "red" isn't same red. line under form remains, if closely can see it: red lines fading red black. if left pixel 254,0,0 next ones not. recommend using blank/real transparent background, png offers :)
Comments
Post a Comment