vb6.0转vb.net 高手帮忙看看这段代码如何转为vb.net2010的代码,谢谢!!
高手帮忙看看这段代码如何转为vb.net2010的代码,谢谢!!PublicSubPrintRTF(RTFhwndAsLong,TextLengthAsLong,Dest...
高手帮忙看看这段代码如何转为vb.net2010的代码,谢谢!!
Public Sub PrintRTF(RTFhwnd As Long, TextLength As Long, Dest As Object, LeftMarginWidth As Long,
TopMarginHeight As Long, mWidth As Long, mHeight As Long)
Dim LeftOffset As Long, TopOffset As Long
Dim LeftMargin As Long, TopMargin As Long
Dim RightMargin As Long, BottomMargin As Long
Dim fr As FormatRange
Dim rcDrawTo As Rect
Dim rcPage As Rect
Dim NextCharPosition As Long
Dim R As Long
Dest.ScaleMode = vbTwips
LeftOffset = Dest.ScaleX(GetDeviceCaps(Dest.hdc, PHYSICALOFFSETX), vbPixels, vbTwips)
TopOffset = Dest.ScaleY(GetDeviceCaps(Dest.hdc, PHYSICALOFFSETY), vbPixels, vbTwips)
LeftMargin = LeftMarginWidth - LeftOffset
TopMargin = TopMarginHeight - TopOffset
RightMargin = LeftMargin + mWidth
BottomMargin = TopMargin + mHeight
rcPage.Left = 0
rcPage.Top = 0
rcPage.Right = Dest.ScaleWidth
rcPage.Bottom = Dest.ScaleHeight
rcDrawTo.Left = LeftMargin
rcDrawTo.Top = TopMargin
rcDrawTo.Right = RightMargin
rcDrawTo.Bottom = BottomMargin
fr.hdc = Dest.hdc
fr.hdcTarget = Dest.hdc
fr.rc = rcDrawTo
fr.rcPage = rcPage
fr.chrg.cpMin = 0
fr.chrg.cpMax = -1
NextCharPosition = SendMessage(RTFhwnd, EM_FORMATRANGE, True, fr)
R = SendMessage(RTFhwnd, EM_FORMATRANGE, False, ByVal CLng(0))
End Sub 展开
Public Sub PrintRTF(RTFhwnd As Long, TextLength As Long, Dest As Object, LeftMarginWidth As Long,
TopMarginHeight As Long, mWidth As Long, mHeight As Long)
Dim LeftOffset As Long, TopOffset As Long
Dim LeftMargin As Long, TopMargin As Long
Dim RightMargin As Long, BottomMargin As Long
Dim fr As FormatRange
Dim rcDrawTo As Rect
Dim rcPage As Rect
Dim NextCharPosition As Long
Dim R As Long
Dest.ScaleMode = vbTwips
LeftOffset = Dest.ScaleX(GetDeviceCaps(Dest.hdc, PHYSICALOFFSETX), vbPixels, vbTwips)
TopOffset = Dest.ScaleY(GetDeviceCaps(Dest.hdc, PHYSICALOFFSETY), vbPixels, vbTwips)
LeftMargin = LeftMarginWidth - LeftOffset
TopMargin = TopMarginHeight - TopOffset
RightMargin = LeftMargin + mWidth
BottomMargin = TopMargin + mHeight
rcPage.Left = 0
rcPage.Top = 0
rcPage.Right = Dest.ScaleWidth
rcPage.Bottom = Dest.ScaleHeight
rcDrawTo.Left = LeftMargin
rcDrawTo.Top = TopMargin
rcDrawTo.Right = RightMargin
rcDrawTo.Bottom = BottomMargin
fr.hdc = Dest.hdc
fr.hdcTarget = Dest.hdc
fr.rc = rcDrawTo
fr.rcPage = rcPage
fr.chrg.cpMin = 0
fr.chrg.cpMax = -1
NextCharPosition = SendMessage(RTFhwnd, EM_FORMATRANGE, True, fr)
R = SendMessage(RTFhwnd, EM_FORMATRANGE, False, ByVal CLng(0))
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询