移除报表预览窗口的Min/Max/Close按钮
来源:优易学  2011-12-9 17:30:11   【优易学:中国教育考试门户网】   资料下载   IT书店

 

  PrivateSubMaximizeRestoredReport(RAsReport)

  'ThiscodewasoriginallywrittenbyTerryKreft

  'Fullcreditsandacknowledgementstohim.

  '

  DimMDIRectAsRECT

  'IftheReportismaximized,restoreit.

  IfIsZoomed(R.hwnd)<>0Then

  ShowWindowR.hwnd,SW_SHOWNORMAL

  EndIf

  'Getthescreencoordinatesandwindowsizeofthe

  'MDIClientarea.

  'Thisisthelinewhichisdifferent

  GetClientRectGetParent(R.hwnd),MDIRect

  'MovetheReporttotheupperleftcorneroftheMDIClient

  'window(0,0)andsizeittothesamesizeasthe

  'MDIClientwindow.

  MoveWindowR.hwnd,0,0,MDIRect.right-MDIRect.left,_

  MDIRect.bottom-MDIRect.top,True

  EndSub

  SubsRemoveCaption(rptAsReport)

  DimlngRetAsLong,lngStyleAsLong

  DimtRECTAsRECT,lngXAsLong

  DimlngCaptionWidthAsLong

  DimlngLeftAsLong

  DimlngTopAsLong

  DimlngWidthAsLong

  DimlngHeightAsLong

  lngRet=apiGetWindowLong(rpt.hwnd,GWL_STYLE)

  lngStyle=(lngRetXorWS_DLGFRAMEXor_

  WS_THICKFRAME)AndNotWS_CAPTION

  'NeedtheXorabovetokeepwindowfrombeingsizable

  lngRet=apiSetWindowLong(rpt.hwnd,GWL_STYLE,lngStyle)

  lngX=apiGetWindowRect(rpt.hwnd,tRECT)

  'havetoresizetheformnow

  'howmuchwascaption'sscreenspace

  lngCaptionWidth=apiGetSystemMetrics(SM_CYCAPTION)

  WithtRECT

  lngLeft=.left

  lngTop=.top

  lngWidth=.right-.left

  lngHeight=.bottom-.top-lngCaptionWidth

  ConvertPIXELSToTWIPSlngLeft,lngTop

  ConvertPIXELSToTWIPSlngWidth,lngHeight

  DoCmd.SelectObjectacReport,rpt.Name,False

  DoCmd.Restore

  DoCmd.MoveSizelngLeft,lngTop,lngWidth,lngHeight

  EndWith

  'nowuseTerry'scodehere

  CallMaximizeRestoredReport(rpt)

  EndSub

  SubConvertPIXELSToTWIPS(xAsLong,YAsLong)

  'FromtheKB

  DimhDCAsLong,hwndAsLong,RetValAsLong

  DimXPIXELSPERINCH,YPIXELSPERINCH

  ConstLOGPIXELSX=88

  ConstLOGPIXELSY=90

  hDC=apiGetDC(0)

  XPIXELSPERINCH=apiGetDeviceCaps(hDC,LOGPIXELSX)

  YPIXELSPERINCH=apiGetDeviceCaps(hDC,LOGPIXELSY)

  RetVal=apiReleaseDC(0,hDC)

  x=(x/XPIXELSPERINCH)*TWIPSPERINCH

  Y=(Y/YPIXELSPERINCH)*TWIPSPERINCH

  EndSub

  '************************CodeEnd**************************

上一页  [1] [2] 

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训