Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resizing Docked Form's Height Programmatically
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01017705
Message ID:
01018204
Views:
42
Here's a further posting on the toolbar gradient... it will demonstrate that a gradient can be done, but since the Form and the controls get painted at the same time (except in the case of themed command buttons that are being hovered over for soem reason) the gradient overwrites controls contained in the toolbar. Run the sample below and you'll see that it is blank, however if you hover over the buttons that are "invisible" you will see that XP Themes does a nice job of repainting them with focus (hot-tracking). I'm including this because maybe with the new VFP 9 ability to hook window events and such there might be a way to do this now and it is always easier to start with a working example that shows the problematic behavior than with just a description of it.
PUBLIC oGradTbr
oGradTbr = CREATEOBJECT("GradientToolbar")
oGradTbr.addobject("Command1", "CommandButton")
oGradTbr.Command1.visible = .T.
oGradTbr.addobject("Command2", "CommandButton")
oGradTbr.Command2.visible = .T.
oGradTbr.addobject("Command3", "CommandButton")
oGradTbr.Command3.visible = .T.
oGradTbr.Show()

DEFINE CLASS GradientToolbar as Toolbar
	DoPaint = .T.
	
	PROCEDURE Paint
		this.GradientFill
	ENDPROC

	PROCEDURE GradientFill
		*!* Procedure Code slightly modified from a post by Aircon on Tek-Tips
		*!* http://www.tek-tips.com/viewthread.cfm?qid=778606
		Local lnhDC, lnWidth, lnHeight
		Local lcVertex, lcVert1, lcVert2, lcRect

		Declare Long GetDC in User32 Long nhWnd
		Declare Long ReleaseDC in User32 Long nhWnd, Long hDC
		Declare Long GradientFill in Msimg32 ;
		    Long hDC, String pVertex, Long dwNumVertex, ;
		    String pMesh, Long dwNumMesh,  Long dwMode

		lnhDC = GetDC( this.hWnd )
		lnWidth = this.Width
		lnHeight = this.Height

		lcVert1 = this.Num2DWord( 0 ) + This.Num2DWord( 0 ) + ;
		    This.Num2Word( 0xFFFF ) + This.Num2Word( 0xFFFF ) + ;
		    This.Num2Word( 0xFFFF ) + This.Num2Word( 0xFFFF )
		lcVert2 = This.Num2DWord( lnWidth ) + This.Num2DWord( lnHeight ) + ;
		    This.Num2Word( 0x0000 ) + This.Num2Word( 0x0000 ) + ;
		    This.Num2Word( 0xFF00 ) + This.Num2Word( 0x0000 )
		lcVertex = lcVert1 + lcVert2
		lcRect = This.Num2DWord( 0 ) + This.Num2DWord( 1 )
		GradientFill( lnhDC, lcVertex,2, lcRect,1, 0 )

		ReleaseDC( _Screen.hWnd, lnhDC )
		Clear Dlls
	ENDPROC

	Procedure Num2Word(tnNum)
	Local lc0, lc1
	    lc1 = chr(int(tnNum / 256))
	    lc0 = chr(mod(tnNum, 256))

	    Return lc0 + lc1
	EndProc


	Procedure Num2DWord(tnNum)
	Local lc0, lc1, lc2, lc3, lcResult
	    lc3 = chr(int(tnNum / 16777216))
	    tnNum = mod(tnNum, 16777216)

	    lc2 = chr(int(tnNum / 65536))
	    tnNum = mod(tnNum, 65536)

	    lc1 = chr(int(tnNum / 256))
	    lc0 = chr(mod(tnNum, 256))
	    lcResult = lc0 + lc1 + lc2 + lc3

	    Return lcResult
	ENDPROC
ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform