Hi,
I’m trying to create a transparent window with a StaticText on it, but I
didn’t found out how this is possible. My Code looks like this:
#Encoding: UTF-8
require “wx”
require “wx_sugar”
include Wx
class TransparentFrame < Frame
def initialize
super(nil, -1, “Test”, DEFAULT_POSITION, Size.new(400, 400),
DEFAULT_FRAME_STYLE | TRANSPARENT_WINDOW) #defining transparency style
set_background_colour(Colour.new(0, 0, 0, 0)) #Setting transparent
back
end
#Overriding has_transparent_background
def has_transparent_background
true
end
end
class Sample < App
def on_init
@mainwindow = TransparentFrame.new #Creating transparent Frame
@text = StaticText.new(@mainwindow, -1, “Test”)
@text.set_foreground_colour(Colour.from_hex("#FFFFFF"))
@text.set_font(Font.new(60, FONTFAMILY_ROMAN, FONTSTYLE_NORMAL,
FONTWEIGHT_BOLD))
@text.centre_on_parent
@mainwindow.show
end
end
x = Sample.new
x.main_loop
That only displays a white text on a black background - no transparency.
I’m working with
Windows Vista Home Premium
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mingw32]
Marvin