>PUBLIC goToolbar >goToolbar = CREATEOBJECT("BorderlessToolbar") >goToolbar.Show() > >DEFINE CLASS BorderlessToolbar as Toolbar > > Top = 0 && hide top margin (take into consideration border, titlebar > Left = 0 && hide left margin > > * my init > PROCEDURE Init() > * add main container which we use to control size and visual presentation (borders, picture, etc) > this.AddObject( "cntMain", "Container" ) > with This.cntMain > .Height = 25 > .Width = 800 && screenwidth + 2 > .BorderColor = 255 > .BorderWidth = 1 > .Backcolor = rgb( 224, 255, 255 ) > .Picture = "tbar_blue.bmp" > > * add border since container .Picture overwrites container .Border > .AddObject( "shpBorder", "Shape" ) > .shpBorder.BorderStyle = 1 > .shpBorder.BackStyle = 0 > .shpBorder.Move( 0, 0, .Width, .Height ) > .shpBorder.Visible = .T. > > * add exit button > .AddObject( "btnExit", "Exitbutton" ) > .btnExit.Move( 2, 2, 80, 20 ) > .btnExit.Visible = .T. > > .Visible = .T. > endwith > > 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 > > * increase the first two parameters sent to SetDisplayRegion and decrease the last two parameters > * until all of the border is gone. > tnX1 = tnX1 + 6 > tnY1 = tnY1 + 3 > tnX2 = tnX2 - 4 > tnY2 = tnY2 - 4 > > RegiondeLinea = CreateRectRgn(tnX1, tnY1, tnX2, tnY2) > SetWindowRgn(This.Hwnd, RegiondeLinea, 1) > DeleteObject(RegiondeLinea) > ENDPROC > >ENDDEFINE > >DEFINE CLASS ExitButton as CommandButton > Caption = "Exit Toolbar" > > FontSize = 8 > > * updated to reflect parent container > PROCEDURE Click > this.Parent.Parent.Release() > ENDPROC >ENDDEFINE >>