.WindowName = "MinBtn"
End With
frmMain.Window.AddChild frmMain.MinimizeButton
With frmMain.MaximizeButton
.ObjectType = MaxBtn
.ParentHeight = frmMain.Window.Height
.ParentWidth = frmMain.Window.Width
.ParentX = frmMain.Window.X
.ParentY = frmMain.Window.Y
.ObjectSurface = objDD.CreateSurfaceFromFile(App.Path & "\maximize.bmp", ddsdSurf4)
.WindowName = "MaxBtn"
End With
frmMain.Window.AddChild frmMain.MaximizeButton
With frmMain.RestoreButton
.ObjectType = RestoreBtn
.ParentHeight = frmMain.Window.Height
.ParentWidth = frmMain.Window.Width
.ParentX = frmMain.Window.X
.ParentY = frmMain.Window.Y
.ObjectSurface = objDD.CreateSurfaceFromFile(App.Path & "\restore.bmp", ddsdSurf4)
.WindowName = "RestoreBtn"
End With
frmMain.Window.AddChild frmMain.RestoreButton
This is code that used to be in the InitDD function, but has been moved out for a good reason, as you抣l see soon. It allows us to recreate the base window object and all children whenever we want. Notice also that we抳e changed the code to use the With匛ndWIth statements. It抯 saves our poor little fingers from having to type as much and speeds up the code a bit (not that it抣l be noticeable unless you timed it.
If you compare this chunk of code with the code to create the OK button, you抣l notice that we抮e not setting any X and Y or ObjectState properties for the buttons. That抯 because you can抰. The buttons only go in one place, the standard position on the window they抮e attached to. The properties are set in the ObjectSurface Property Set method:
Case MinBtn
iHeight = ddsd.lHeight / 2
iX = iParentWidth iParentX - iWidth - 40
iY = iParentY 7
iObjectState = iEnabled
Case MaxBtn
iHeight = ddsd.lHeight / 2
iX = iParentWidth iParentX - iWidth - 24
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




