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
Change colours in forms (gadgets)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
5 minutes later... Here is the same, but with a bitmap
.
Fred - AlphaSND
Edited by - fred on 17 December 2001 17:29:21
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.Is there any way to change the colours of forms or is that an API function perhaps.??
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))[]
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
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
your gadgets, or after? They have to be done before to work.
Edited by - PB on 18 December 2001 06:52:45
Both of these functions work fine for me. Did you use them before creatingI'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.
your gadgets, or after? They have to be done before to work.
Edited by - PB on 18 December 2001 06:52:45
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
Here is a little working example:
Run this example and have some fun... 
cya,
...Danilo
(registered PureBasic user)
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
cya,
...Danilo
(registered PureBasic user)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
to date. I once had a similar problem and it was fixed with an upgrade patch.
This may sound stupid, but see if your video driver for your video card is upMaybe 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".
to date. I once had a similar problem and it was fixed with an upgrade patch.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
Heya Fangbeast !!
Tried my example ??
should work.
cya,
...Danilo
(registered PureBasic user)
Heya Fangbeast !!
Tried my example ??
Code: Select all
RedrawWindow_(hWnd.l,0,0,7) ; 7= RDW_INVALIDATE | RDW_INTERNALPAINT | RDW_ERASE
cya,
...Danilo
(registered PureBasic user)