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:
01018020
Views:
88
>Intuitively, it would seem there would be a way to "scrape" away a toolbar's border, titlebar, and margins using basic Windows API calls applied to a toolbar's hWnd.

If I'm understanding you right, you mean something like this (cut-n-paste runnable example of toolbar without titlebar or borders)...
PUBLIC goToolbar
goToolbar = CREATEOBJECT("BorderlessToolbar")
goToolbar.Show()

DEFINE CLASS BorderlessToolbar as Toolbar
	PROCEDURE Init()
		*!* Set up some objects for the toolbar and give us an exit button
		this.AddObject("Command1", "Commandbutton")
		this.command1.visible = .T.
		this.AddObject("Command2", "Commandbutton")
		this.command2.visible = .T.
		this.AddObject("Command3", "Exitbutton")
		this.command3.visible = .T.
		this.SetAll("Height", 22)
	ENDPROC
	
	PROCEDURE Show
		LPARAMETERS nStyle
		IF DODEFAULT(nStyle)
			this.Resize()
		ENDIF
	ENDPROC
	
	PROCEDURE Resize
		this.SetDisplayRegion(3, SYSMETRIC(9) - 5, this.Width + 3, this.Height + SYSMETRIC(9) - 4)
	ENDPROC
	
	PROCEDURE AfterDock
		LPARAMETERS nLocation, oForm
		this.SetDisplayRegion(0, 0, this.Width, this.Height)
	ENDPROC
	
	PROCEDURE Undock
		LOCAL lnDockPosition
		lnDockPosition = this.DockPosition
		IF INLIST(lnDockPosition, 0, 3)
			this.SetDisplayRegion(3, SYSMETRIC(9) - 5, this.Width - 5, this.Height+ SYSMETRIC(9) - 5)
		ELSE
			this.SetDisplayRegion(3, SYSMETRIC(9), this.Width + 1, this.Height + SYSMETRIC(9) - 13)
		ENDIF
	ENDPROC
	
	PROCEDURE SetDisplayRegion(tnX1, tnY1, tnX2, tnY2)
		DECLARE INTEGER DeleteObject IN gdi32 INTEGER hObject
		DECLARE INTEGER CreateRectRgn IN gdi32;
			INTEGER X1, INTEGER Y1, INTEGER X2, INTEGER Y2
		DECLARE INTEGER SetWindowRgn IN user32 ;
			INTEGER HWND, INTEGER hRgn , INTEGER bRedraw
		RegiondeLinea = CreateRectRgn(tnX1, tnY1, tnX2, tnY2)
		SetWindowRgn(This.Hwnd, RegiondeLinea, 1)
		DeleteObject(RegiondeLinea)
	ENDPROC

ENDDEFINE

DEFINE CLASS ExitButton as CommandButton
	Caption = "Exit Toolbar"
	PROCEDURE Click
		this.Parent.release()
	ENDPROC
ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform