đăng 20:24 27 thg 3, 2012 bởi Hai Yen
[
đã cập nhật 07:44 16 thg 9, 2014
]
Tôi muốn tạo một đường viền cho report giống như boder style của word khi in mà kô phải mất công kẻ bằng tay được ko? Trả lời: Có hai cách để làm việc này.
Cách một: Chép đoạn mã sau vào report cần Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer) 'goi Drawline procedure DrawLine End Sub ----------------------------------------------------------------------- Sub DrawLine() Dim rpt As Report, lngColor As Long Dim sngTop As Single, sngLeft As Single Dim sngWidth As Single, sngHeight As Single Set rpt = Reports!EmployeeReport ' thiet lap loai pixels. rpt.ScaleMode = 3 ' Top sngTop = rpt.ScaleTop + 5 ' Left sngLeft = rpt.ScaleLeft + 5 ' Width sngWidth = rpt.ScaleWidth - 10 ' Height sngHeight = rpt.ScaleHeight - 10 ' mau sac: Do lngColor = RGB(255,0,0) ' Draw line as a box. rpt.Line(sngTop, sngLeft) - (sngWidth, sngHeight), lngColor, B End Sub Cách 2: lại code Private Sub Report_Page() On Error Resume Next Me.DrawWidth = 6 ' do rong duong line Me.DrawStyle = 0 ' 0 den 6 => kieu duong mat dan ' Sử dụng công thức object.Line (x1, y1) - (x2,y2), color, [Box=B] Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbred, B End Sub |
|