Page 1 of 1
Posted: Mon Dec 17, 2001 12:18 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
Is there any way to change the colours of forms or is that an API function perhaps.??
regards
Fangles
Posted: Mon Dec 17, 2001 5:21 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
Is there any way to change the colours of forms or is that an API function perhaps.??
As you asked it so nicely, here is the tip ! Note than you can use a bitmap too instead of a single color.. Just open a window and paste this code.
Code: Select all
Procedure RVB(Red, Green, Blue)
ProcedureReturn Red + Green<<8 + Blue<<16
EndProcedure
Brush.LOGBRUSH\lbColor = RVB(0,0,144)
SetClassLong_(WindowID(), #GCL_HBRBACKGROUND, CreateBrushIndirect_(Brush))[]
5 minutes later... Here is the same, but with a bitmap

.
Code: Select all
Brush.LOGBRUSH\lbStyle = #BS_PATTERN
Brush\lbColor = #DIB_RGB_COLORS
Brush\lbHatch = LoadImage(0, "C:\Windows\Aquarium.bmp")
SetClassLong_(WindowID(), #GCL_HBRBACKGROUND, CreateBrushIndirect_(Brush))
Fred - AlphaSND
Edited by - fred on 17 December 2001 17:29:21
Posted: Tue Dec 18, 2001 6:51 am
by BackupUser
Restored from previous forum. Originally posted by PB.
I've tried both examples. With the bitmap, the entire picture takes over the form till you can't see anything. You have to click on various areas to see them again.
Witht he solid colour, you have to run your program, have another window on top of it and then click back to our program for the colour to be active. Very strange.
Both of these functions work fine for me. Did you use them before creating
your gadgets, or after? They have to be done before to work.
Edited by - PB on 18 December 2001 06:52:45
Posted: Tue Dec 18, 2001 7:20 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
Here is a little working example:
Code: Select all
; Example to Show:
; - Open a Window centered on the Screen and without Border
; - Add a Window Background and Redraw the Window
; - Add Exit Button
; - The Window is MOVEABLE with LeftMouseButton pressed !!
;Open a Window, centered on the Screen
#WINWIDTH = 640
#WINHEIGHT = 480
hWnd.l = OpenWindow(0,(GetSystemMetrics_(#SM_CXSCREEN)-#WINWIDTH)/2,(GetSystemMetrics_(#SM_CYSCREEN)-#WINHEIGHT)/2,#WINWIDTH,#WINHEIGHT,#WS_POPUP,"Test")
SetForeGroundWindow_(hWnd.l)
;Add a Background Picture and RedrawWindow
Brush.LOGBRUSH\lbStyle = #BS_PATTERN
Brush\lbColor = #DIB_RGB_COLORS
Brush\lbHatch = LoadImage(0, "C:\WINNT\Greenstone.bmp")
SetClassLong_(hWnd.l, #GCL_HBRBACKGROUND, CreateBrushIndirect_(Brush))
RedrawWindow_(hWnd.l,0,0,7) ; 7= RDW_INVALIDATE | RDW_INTERNALPAINT | RDW_ERASE
;Add EXIT Button
InitGadget(1)
If CreateGadgetList(hWnd.l)
ButtonGadget(0, #WINWIDTH-100, #WINHEIGHT-25, 100, 25, "EXIT")
EndIf
; MessageLoop
Repeat
EventID.l = WaitWindowEvent()
; IF LeftMouseButton pressed...
If EventID = #WM_LBUTTONDOWN
ReleaseCapture_()
SendMessage_(hWnd.l,#WM_NCLBUTTONDOWN, #HTCAPTION,0)
EndIf
; Check GadGets
If EventID = #PB_EventGadget
Select EventGadgetID()
Case 0 ; EXIT
Quit = 1
EndSelect
EndIf
; pressed CloseButton or ALT+F4 ??
If EventID = #PB_EventCloseWindow
Quit = 1
EndIf
Until Quit = 1
End
Run this example and have some fun...
cya,
...Danilo
(registered PureBasic user)
Posted: Wed Dec 19, 2001 3:19 am
by BackupUser
Restored from previous forum. Originally posted by PB.
Maybe it's WIndows XP but both functions act as a 'bleed though' mechanism,
instead of a paint. Could have something to do with "indirect paint".
This may sound stupid, but see if your video driver for your video card is up
to date. I once had a similar problem and it was fixed with an upgrade patch.
Posted: Wed Dec 19, 2001 5:41 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
Heya Fangbeast !!
Tried my example ??
Code: Select all
RedrawWindow_(hWnd.l,0,0,7) ; 7= RDW_INVALIDATE | RDW_INTERNALPAINT | RDW_ERASE
should work.
cya,
...Danilo
(registered PureBasic user)