How to set a 'Tiled background' for GUI ?
http://www.autohotke...p=467410#467410#SingleInstance, Force IfNotExist, tile.bmp, UrlDownloadToFile, http://goo.gl/F9KIf, tile.bmp IfNotExist, lens.png, UrlDownloadToFile, http://i.imgur.com/pGL6k.png, lens.png Gui +Resize ; [color=#808080]Gui, Color, FFFFFF[/color] [color=Red] ; <- NEVER USE THIS along with WM_CTLCOLORDLG[/color] [color=darkred]OnMessage([/color] 0x136, "[color=red]WM_CTLCOLORDLG[/color]" [color=darkred])[/color] Gui, Font, S30 Bold, Arial Black Gui, Add, Text, w450 y90 c880000 Border 0x201, WM_CTLCOLORDLG Gui, Add, Picture, xm+25 ym BackgroundTrans, lens.png Gui, Show,, GUI with 'Tiled background' ( Maximize/Resize this window ) Sleep 1 Return [color=red]WM_CTLCOLORDLG() {[/color] Static wBrush If ! wBrush hBM := DllCall( "[color=darkred]LoadImage[/color]", Int,0, Str,"tile.bmp", Int,0, Int,0, Int,0, UInt,0x2010 ) , wBrush := DllCall( "[color=darkred]CreatePatternBrush[/color]", UInt,hBM ) Return wBrush [color=red]}[/color]
The code snippet should be self explanatory, except for a couple of DllCalls.
All you might need is to change the file name for "tile.bmp" to your own bitmap.
The code snippet downloads the following two images:
[*:2e5lr0tw]Do not use Gui, Color, < Color > when monitoring WM_COLORCTLDLG. Your script will never receive the message.
[*:2e5lr0tw]If your GUI is fixed size and you fancy gradient background, you may use GDI_QuickBitmap()
[How To] set a 'Tiled background' for GUI ?
#1
Posted 17 August 2011 - 08:58 PM
#2
Posted 18 August 2011 - 02:09 AM
No later than the other day I was playing with this Pattern Brush, trying to set a bitmap background to an Edit control. Subclassing the Window Procedure and hooking WM_CTLCOLOREDIT works fine, as long as there's no text in the Edit box. But as soon as I type something inthere, the whole row will be filled with the designated background color, hiding the bitmap background.
Do you know if there's a way to draw the text transparently in an Edit control, so as to preserve the bitmap background aspect? 8)
#3
Posted 18 August 2011 - 07:39 AM
Looks like we're circling around the same places lately.
I have been attempting to reproduce USkin's functionality with native message monitoring ( global subclassing ).
Even USkin is unable to override Gui, Color command.
BTW, I decided to post this tip ( before I forget ) after seeing ( again ) this hard solution: Tiled GUI background?
a way to draw the text transparently in an Edit control, so as to preserve the bitmap background aspect? 8)
Call SetBkMode() before returning the Brush:
DllCall( "SetBkMode", UInt,wParam, UInt,1 ) ; TRANSPARENT
Also, take a look at Lexikos' code ( the original idea ) : <!-- m -->http://www.autohotke... ... 695#164695<!-- m -->
#4
Posted 18 August 2011 - 09:17 AM
There's still an issue that most likely belongs to Win9x, where the brush appears shifted both vertically and horizontally, thing that does not happen on XP (with the same code). I know Win95 doesn't accept bitmaps larger than 8x8 px, but Win98 and later are supposed to. Oh well, that's another thing I'll have to test further.
That USkin, is it of any good? I'm not sure I can test it here, since I already have Tihiy's Revolutions Pack installed on my 98SE, which includes a full system skiining engine, which used to be called UberSkin - quite close resemblance to this USkin. I'll go have a look though, maybe it has some good ideas to offer.
EDIT: see comparison screenshot below
#5
Posted 18 August 2011 - 09:33 AM
It does not support all controls and offers no flexibility.That USkin, is it of any good?
Even to change a font, one has to resort to GuiControl after creating the control.
I'm not sure I can test it here, since I already have Tihiy's Revolutions Pack installed on my 98SE, which includes a full system skiining engine, which used to be called UberSkin - quite close resemblance to this USkin. I'll go have a look though, maybe it has some good ideas to offer.
Please let me know. I guess that: if it uses a global hook then it will have the upper-hand.
#6
Posted 18 August 2011 - 09:52 AM
I'll look at the code but honestly, my hopes are low considering it's written in C# (if I'm not mistaken).
If you could get Tihiy (at the MSFN.org forum) to show you the UberSkin code used in Revolutions Pack, now that may be a good source of inspiration. I'm not sure if he would do that, though.
EDIT: I just remembered this toy, always from CodeProject, that I has tested few years ago and it does work in 98SE (with .NET installed): XPExplorerBar. I personally am not fond of .NET though, it's too high of a language for me; I'd prefer ASM if I had to choose.
#7
Posted 19 December 2011 - 07:34 PM
is possible to make a function to directly add one?How to set a 'Tiled background' for GUI ?
example:
AddGUIBackground("Tile.bmp")then, have the background Tile.bmp in the GUI...and, if is possible... say the function here?







