日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

一个人的朝圣深度感悟_朝圣之末找到更强大的WordWrap函数

發(fā)布時(shí)間:2024/3/12 编程问答 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一个人的朝圣深度感悟_朝圣之末找到更强大的WordWrap函数 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一個(gè)人的朝圣深度感悟

What Started It All

是什么開始了

I had an instance recently where I needed to take text from a textbox on a VBA form and split the text into separate lines to send to a zebra printer. ?The catch was that I needed the text to break at the same line points as the VBA textbox. ?The textbox was configured with multiline and wordwrap enabled. ?Searching all over the internet for a function or idea to accomplish this task, I found plenty of examples of wrapping text based on already included carriage returns or just of a space and character count, but not what I needed. ?A VBA textbox may or may not have carriage returns and it splits text on more than just spaces. ?

最近我有一個(gè)實(shí)例,我需要從VBA表單上的文本框中獲取文本并將文本拆分成單獨(dú)的行以發(fā)送到Zebra打印機(jī)。 問題是我需要文本在與VBA文本框相同的行點(diǎn)處中斷。 文本框已配置為啟用多行和自動(dòng)換行。 在Internet上搜索用于完成此任務(wù)的功能或構(gòu)想,我發(fā)現(xiàn)了很多基于已經(jīng)包含回車符或僅包含空格和字符數(shù)來包裝文本的示例,但不是我所需要的。 VBA文本框可能有回車符,也可能沒有回車符,它會(huì)在多個(gè)空格上分割文本。

This led me on a quest to build a word wrap function mimicking the wrapping of a textbox. ?Working through coding and testing, I ended up creating a few different versions. ?The earlier versions were better than what I had found, but not good enough for my needs. ?They are posted here in case they are good enough for you. ?The original function returned data in a string array, but it was easy to adjust it to return as single string with carriage returns to break apart each line. ?That code is also included.

這使我開始尋求構(gòu)建模仿文字框自動(dòng)換行的自動(dòng)換行功能。 通過編碼和測試,我最終創(chuàng)建了幾個(gè)不同的版本。 較早的版本比我發(fā)現(xiàn)的要好,但不足以滿足我的需求。 如果它們對您足夠好,則會(huì)在此處發(fā)布。 原始函數(shù)以字符串?dāng)?shù)組的形式返回?cái)?shù)據(jù),但是很容易將其調(diào)整為帶有回車符的單個(gè)字符串以將每一行分開。 該代碼也包括在內(nèi)。

Breakdown of the basic code:

基本代碼明細(xì):

A textbox has a variety of rules on how it separates text. ?The first step is to take the text and split it into an array based on already defined line feeds. ?Use the line feed (vbLf) as this will catch user entered returns from both Enter Key (If EnterKeyBehavior = True) and Cntrl-Enter (if EnterKey Behavior=False).

文本框?qū)τ谌绾畏指粑谋揪哂卸喾N規(guī)則。 第一步是獲取文本并將其根據(jù)已定義的換行符拆分為一個(gè)數(shù)組。 使用換行符(vbLf),因?yàn)樗鼘⒉东@用戶從Enter鍵(如果EnterKeyBehavior = True)和Cntrl-Enter(如果EnterKey Behavior = False)輸入的返回值。

strLineData = Split(TextToWrap, vbLf) ' This is the RegEx List for Characters that should be grouped with the text that follows them ' ${(<[\ - Have to use escape character "\" for ] and \ strStartGroup = "${(<\[\\" ' This is the RegEx List for Characters that should be grouped with the text the preceeds them ' !)}%>?-] - Have to use escape character "\" for - and ] strEndGroup = "!)}%>?\-\]" ' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instances strRegPattern = "[" & strStartGroup & "]?" ' Now grab all characters that are not part of special list and no spaces \s ' [] = Group. Find Anything listed in this group. + = Find 1 to many instances. ' Equates to finding whole words including some special characters (those not in list since negative comparison) strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+" ' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instances strRegPattern = strRegPattern & "[" & strEndGroup & "]?" objRegExp.Pattern = strRegPattern Set objWordList = objRegExp.Execute(strLine)

The first function I created calculated the width of each line by the number of characters per line. ?These can work well for you if you are using a fixed width font. ?They are simplier and will run slightly faster. ?

我創(chuàng)建的第一個(gè)函數(shù)通過每行的字符數(shù)來計(jì)算每行的寬度。 如果您使用的是固定寬度的字體,則這些字體對您來說效果很好。 它們比較簡單,運(yùn)行速度會(huì)稍快。

I have included a VBScript version using late binding. ?

我已經(jīng)包括了使用后期綁定的VBScript版本。

WordWrapByCharacterToArray Function:

WordWrapByCharacterToArray 功能:

Here is the first function. ?To use this function, send it the text that you want word wrapped and the maximum number of characters per line. ?It will return a string array with each line as a separate element in the array.

這是第一個(gè)功能。 要使用此功能,請向其發(fā)送您要自動(dòng)換行的文本以及每行最大字符數(shù)。 它將返回一個(gè)字符串?dāng)?shù)組,其中每一行作為數(shù)組中的單獨(dú)元素。

Example Usage:

用法示例:

Dim strLines() As String strLines = WordWrapByCharacterToArray(TextToWrap:=TextBox1.Text, LengthOfLine:=20) For i = 0 To UBound(strLines)Debug.Print strLines(i) Next '--------------------------------------------------------------------------------------- ' Function : WordWrapByCharacterToArray ' Date : 03/21/2012 ' Purpose : Will Return a String array of line data wrapped at proper break points ' for a given line length as determined by the number of characters. ' It uses the same rules as a VBA text box ' ' Usage : Set a string array = to WordWrapByCharacterToArray sending WordWrapByCharacterToArray ' your text and maximum length for each line ' Example: ' Dim strLines() as string ' strLines = WordWrapByCharacterToArray("This is my text I want to wrap around something", 15) ' This will break the string into multiple lines with a maximum length of 15 characters per line '--------------------------------------------------------------------------------------- ' Public Function WordWrapByCharacterToArray(ByVal TextToWrap As String, _ByVal LengthOfLine As Long) As String()On Error GoTo WordWrapByCharacterToArray_Error:Dim objRegExp As VBScript_RegExp_55.RegExpDim objWordList As VBScript_RegExp_55.MatchCollectionDim objWord As VBScript_RegExp_55.MatchDim strStartGroup As StringDim strEndGroup As StringDim strRegPattern As StringDim intLineNum As Integer: intLineNum = 0Dim intLinePos As IntegerDim strReturn() As StringDim strLineData() As StringDim strLine As VariantDim intNumCharUsed As Integer' Instantiate RegExSet objRegExp = New VBScript_RegExp_55.RegExp' ------------------------------------' Set Set Font Settings' ------------------------------------' Make sure we were sent a good line widthIf LengthOfLine < 1 Then' Return an ErrorErr.Raise Number:=vbObjectError + 605, Description:="Requested Length of Line must be greater than 0"End If' ------------------------------------' Set RegEx Settings' ------------------------------------objRegExp.MultiLine = FalseobjRegExp.Global = True' ------------------------------------' Set the Search Pattern' ------------------------------------' This is the RegEx List for Characters that should be grouped with the text that follows them' ${(<[\ - Have to use escape character "\" for ] and \strStartGroup = "${(<\[\\"' This is the RegEx List for Characters that should be grouped with the text the preceeds them' !)}%>?-] - Have to use escape character "\" for - and ]strEndGroup = "!)}%>?\-\]"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = "[" & strStartGroup & "]?"' Now grab all characters that are not part of special list and no spaces \s' [] = Group. Find Anything listed in this group. + = Find 1 to many instances.' Equates to finding whole words including some special characters (those not in list since negative comparison)strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = strRegPattern & "[" & strEndGroup & "]?"objRegExp.Pattern = strRegPattern' ------------------------------------' Break up Original String into already defined lines' ------------------------------------strLineData = Split(TextToWrap, vbLf)' ------------------------------------' Set Original Size of Return Array to just one line. Can Expand Later' ------------------------------------ReDim Preserve strReturn(0)' ------------------------------------' Loop through each line to wrap text if needed' ------------------------------------For Each strLine In strLineData' Reset the Line Position for this set of textintLinePos = 0' Make sure the line is long enough to need to be wrappedIf Len(strLine) > LengthOfLine Then' ------------------------------------' Get the list of words defined by the Pattern' ------------------------------------Set objWordList = objRegExp.Execute(strLine)' ------------------------------------' Build the Return Array' ------------------------------------For Each objWord In objWordList' See if this word is too big to FitIf objWord.Length > LengthOfLine Then' Word is too big for the line, have to break it appart' Reset the Number of Characters used in this word to 1intNumCharUsed = 1' First see if we have any remaining words that should be added to the previous lineIf objWord.FirstIndex - intLinePos > 0 Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Save Previous LinestrReturn(intLineNum) = Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfDo While intNumCharUsed < objWord.Length' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Get as many characters as will fit on the linestrReturn(intLineNum) = Mid(objWord.Value, intNumCharUsed, LengthOfLine)' Increase the Number used counterintNumCharUsed = intNumCharUsed + Len(strReturn(intLineNum))' Reset the Line PositionintLinePos = intLinePos + Len(strReturn(intLineNum))' Increment our line CounterintLineNum = intLineNum + 1LoopElseIf objWord.FirstIndex - intLinePos + objWord.Length > LengthOfLine Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' This word will not fit on current Line. Save Current LinestrReturn(intLineNum) = Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfEnd If 'objWord.Length > LengthOfLineNext' ------------------------------------' See if there is any text yet to add' ------------------------------------If (Len(strLine) - intLinePos) > 0 Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Save of the Last bits of DatastrReturn(intLineNum) = Right(strLine, Len(strLine) - intLinePos)' Increment our line CounterintLineNum = intLineNum + 1End IfElse' ------------------------------------' The entire line fits. Add it now' ------------------------------------' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End IfstrReturn(intLineNum) = strLine' Increment our line CounterintLineNum = intLineNum + 1End IfNext' Return our ArrayWordWrapByCharacterToArray = strReturnRelease:On Error Resume NextErase strReturnSet objWordList = NothingSet objWord = NothingSet objRegExp = NothingExit FunctionWordWrapByCharacterToArray_Error:MsgBox "Procedure = WordWrapByCharacterToArray" & vbCrLf & _"Error Number = " & Err.Number & vbCrLf & _"Error Message = " & Err.Description & vbCrLf, _vbCritical Or vbSystemModal, "Word Wrap Error"Resume Release: End Function VBScript Version:'--------------------------------------------------------------------------------------- ' Function : WordWrapByCharacterToArray ' Date : 03/21/2012 ' Purpose : Will Return a String array of line data wrapped at proper break points ' for a given line length as determined by the number of characters. ' It uses the same rules as a VBA text box ' ' Usage : Set a string array = to WordWrapByCharacterToArray sending WordWrapByCharacterToArray ' your text and maximum length for each line ' Example: ' Dim strLines ' strLines = WordWrapByCharacterToArray("This is my text I want to wrap around something", 15) ' This will break the string into multiple lines with a maximum length of 15 characters per line '--------------------------------------------------------------------------------------- ' Public Function WordWrapByCharacterToArray(TextToWrap, LengthOfLine)Dim objRegExp, objWordList, objWordDim strStartGroup, strEndGroup, strRegPatternDim intLineNum, intLinePos, intNumCharUsedDim strReturn(), strLineData, strLine' Instantiate RegExSet objRegExp = CreateObject("VBScript.RegExp")intLineNum = 0' ------------------------------------' Set Set Font Settings' ------------------------------------' Make sure we were sent a good line widthIf LengthOfLine < 1 Then' Return an ErrorErr.Raise vbObjectError + 605, "Requested Length of Line must be greater than 0"End If' ------------------------------------' Set RegEx Settings' ------------------------------------objRegExp.MultiLine = FalseobjRegExp.Global = True' ------------------------------------' Set the Search Pattern' ------------------------------------' This is the RegEx List for Characters that should be grouped with the text that follows them' ${(<[\ - Have to use escape character "\" for ] and \strStartGroup = "${(<\[\\"' This is the RegEx List for Characters that should be grouped with the text the preceeds them' !)}%>?-] - Have to use escape character "\" for - and ]strEndGroup = "!)}%>?\-\]"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = "[" & strStartGroup & "]?"' Now grab all characters that are not part of special list and no spaces \s' [] = Group. Find Anything listed in this group. + = Find 1 to many instances.' Equates to finding whole words including some special characters (those not in list since negative comparison)strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = strRegPattern & "[" & strEndGroup & "]?"objRegExp.Pattern = strRegPattern' ------------------------------------' Break up Original String into already defined lines' ------------------------------------strLineData = Split(TextToWrap, vbLf)' ------------------------------------' Set Original Size of Return Array to just one line. Can Expand Later' ------------------------------------ReDim strReturn(0)' ------------------------------------' Loop through each line to wrap text if needed' ------------------------------------For Each strLine In strLineData' Reset the Line Position for this set of textintLinePos = 0' Make sure the line is long enough to need to be wrappedIf Len(strLine) > LengthOfLine Then' ------------------------------------' Get the list of words defined by the Pattern' ------------------------------------Set objWordList = objRegExp.Execute(strLine)' ------------------------------------' Build the Return Array' ------------------------------------For Each objWord In objWordList' See if this word is too big to FitIf objWord.Length > LengthOfLine Then' Word is too big for the line, have to break it appart' Reset the Number of Characters used in this word to 1intNumCharUsed = 1' First see if we have any remaining words that should be added to the previous lineIf objWord.FirstIndex - intLinePos > 0 Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Save Previous LinestrReturn(intLineNum) = Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfDo While intNumCharUsed < objWord.Length' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Get as many characters as will fit on the linestrReturn(intLineNum) = Mid(objWord.Value, intNumCharUsed, LengthOfLine)' Increase the Number used counterintNumCharUsed = intNumCharUsed + Len(strReturn(intLineNum))' Reset the Line PositionintLinePos = intLinePos + Len(strReturn(intLineNum))' Increment our line CounterintLineNum = intLineNum + 1LoopElseIf objWord.FirstIndex - intLinePos + objWord.Length > LengthOfLine Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' This word will not fit on current Line. Save Current LinestrReturn(intLineNum) = Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfEnd If 'objWord.Length > LengthOfLineNext' ------------------------------------' See if there is any text yet to add' ------------------------------------If (Len(strLine) - intLinePos) > 0 Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Save of the Last bits of DatastrReturn(intLineNum) = Right(strLine, Len(strLine) - intLinePos)' Increment our line CounterintLineNum = intLineNum + 1End IfElse' ------------------------------------' The entire line fits. Add it now' ------------------------------------' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End IfstrReturn(intLineNum) = strLine' Increment our line CounterintLineNum = intLineNum + 1End IfNext' Return our ArrayWordWrapByCharacterToArray = strReturn' Release the ObjectsOn Error Resume NextSet objWordList = NothingSet objWord = NothingSet objRegExp = Nothing End Function

WordWrapByCharacterToSstring Function:

WordWrapByCharacterToSstri ng功能:

Here is the Next function. ?To use this function, send it the text that you want word wrapped and the maximum number of characters per line. ?It will return a single string with each line in the string separated by a carriage return.

這是Next函數(shù)。 要使用此功能,請向其發(fā)送您要自動(dòng)換行的文本以及每行最大字符數(shù)。 它將返回單個(gè)字符串,字符串中的每一行都用回車符分隔。

Example Usage:

用法示例:

Dim strWrappedLines As String strWrappedLines = WordWrapByPointToString(TextToWrap:=TextBox1.Text, LengthOfLine:=20) Debug.Print strWrappedLines '--------------------------------------------------------------------------------------- ' Procedure : WordWrapByCharacterToString ' Date : 03/23/2012 ' Purpose : Will Return a String array of line data wrapped at proper break points ' for a given line length as determined by the number of characters. ' It uses the same rules as a VBA text box ' *** MUST have a REFERENCE set for MICROSOFT VBSCRIPT REGULAR EXPRESSION 5.5 ' ' Usage : Set a string array = to WordWrapByCharacterToString sending WordWrapByCharacterToString ' your text and maximum length for each line ' Example: ' Dim strWrappedLines as string ' strWrappedLines = WordWrapByCharacterToString("This is my text I want to wrap around something", 15) ' This will break the string into multiple lines with a maximum length of 15 characters per line '--------------------------------------------------------------------------------------- ' Public Function WordWrapByCharacterToString(ByVal TextToWrap As String, _ByVal LengthOfLine As Long) As StringOn Error GoTo WordWrapByCharacterToString_Error:Dim objRegExp As VBScript_RegExp_55.RegExpDim objWordList As VBScript_RegExp_55.MatchCollectionDim objWord As VBScript_RegExp_55.MatchDim strStartGroup As StringDim strEndGroup As StringDim strRegPattern As StringDim intLineNum As Integer: intLineNum = 0Dim intLinePos As IntegerDim strReturn As StringDim strLineData() As StringDim strLine As VariantDim intNumCharUsed As Integer' Instantiate RegExSet objRegExp = New VBScript_RegExp_55.RegExp' ------------------------------------' Set Set Font Settings' ------------------------------------' Make sure we were sent a good line widthIf LengthOfLine < 1 Then' Return an ErrorErr.Raise Number:=vbObjectError + 605, Description:="Requested Length of Line must be greater than 0"End If' ------------------------------------' Set RegEx Settings' ------------------------------------objRegExp.MultiLine = FalseobjRegExp.Global = True' ------------------------------------' Set the Search Pattern' ------------------------------------' This is the RegEx List for Characters that should be grouped with the text that follows them' ${(<[\ - Have to use escape character "\" for ] and \strStartGroup = "${(<\[\\"' This is the RegEx List for Characters that should be grouped with the text the preceeds them' !)}%>?-] - Have to use escape character "\" for - and ]strEndGroup = "!)}%>?\-\]"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = "[" & strStartGroup & "]?"' Now grab all characters that are not part of special list and no spaces \s' [] = Group. Find Anything listed in this group. + = Find 1 to many instances.' Equates to finding whole words including some special characters (those not in list since negative comparison)strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = strRegPattern & "[" & strEndGroup & "]?"objRegExp.Pattern = strRegPattern' ------------------------------------' Break up Original String into already defined lines' ------------------------------------strLineData = Split(TextToWrap, vbLf)' ------------------------------------' Loop through each line to wrap text if needed' ------------------------------------For Each strLine In strLineData' Reset the Line Position for this set of textintLinePos = 0' Make sure the line is long enough to need to be wrappedIf Len(strLine) > LengthOfLine Then' ------------------------------------' Get the list of words defined by the Pattern' ------------------------------------Set objWordList = objRegExp.Execute(strLine)' ------------------------------------' Build the Return Array' ------------------------------------For Each objWord In objWordList' See if this word is too big to FitIf objWord.Length > LengthOfLine Then' Word is too big for the line, have to break it appart' Reset the Number of Characters used in this word to 1intNumCharUsed = 1' First see if we have any remaining words that should be added to the previous lineIf objWord.FirstIndex - intLinePos > 0 Then' Save Previous LinestrReturn = strReturn & (Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfDo While intNumCharUsed < objWord.Length' Get as many characters as will fit on the linestrReturn = strReturn & (Mid(objWord.Value, intNumCharUsed, LengthOfLine) & vbNewLine)' Reset the Line PositionintLinePos = intLinePos + Len(Mid(objWord.Value, intNumCharUsed, LengthOfLine))' Increase the Number used counterintNumCharUsed = intNumCharUsed + Len(Mid(objWord.Value, intNumCharUsed, LengthOfLine))' Increment our line CounterintLineNum = intLineNum + 1LoopElseIf objWord.FirstIndex - intLinePos + objWord.Length > LengthOfLine Then' This word will not fit on current Line. Save Current LinestrReturn = strReturn & (Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfEnd If 'objWord.Length > LengthOfLineNext' ------------------------------------' See if there is any text yet to add' ------------------------------------If (Len(strLine) - intLinePos) > 0 Then' Save of the Last bits of DatastrReturn = strReturn & (Right(strLine, Len(strLine) - intLinePos) & vbNewLine)' Increment our line CounterintLineNum = intLineNum + 1End IfElse' ------------------------------------' The entire line fits. Add it now' ------------------------------------strReturn = strReturn & (strLine & vbNewLine)' Increment our line CounterintLineNum = intLineNum + 1End IfNext' Return our ArrayWordWrapByCharacterToString = strReturnRelease:On Error Resume NextSet objWordList = NothingSet objWord = NothingSet objRegExp = NothingExit FunctionWordWrapByCharacterToString_Error:MsgBox "Procedure = WordWrapByCharacterToString" & vbCrLf & _"Error Number = " & Err.Number & vbCrLf & _"Error Message = " & Err.Description & vbCrLf, _vbCritical Or vbSystemModal, "Word Wrap Error"Resume Release: End Function VBScript Version:'--------------------------------------------------------------------------------------- ' Procedure : WordWrapByCharacterToString ' Date : 03/23/2012 ' Purpose : Will Return a String array of line data wrapped at proper break points ' for a given line length as determined by the number of characters. ' It uses the same rules as a VBA text box ' ' Usage : Set a string array = to WordWrapByCharacterToString sending WordWrapByCharacterToString ' your text and maximum length for each line ' Example: ' Dim strWrappedLines ' strWrappedLines = WordWrapByCharacterToString("This is my text I want to wrap around something", 15) ' This will break the string into multiple lines with a maximum length of 15 characters per line '--------------------------------------------------------------------------------------- ' Public Function WordWrapByCharacterToString(TextToWrap, LengthOfLine)Dim objRegExp, objWordList, objWordDim strStartGroup, strEndGroup, strRegPatternDim intLineNum, intLinePos, intNumCharUsedDim strReturn, strLineData, strLine' Instantiate RegExSet objRegExp = CreateObject("VBScript.RegExp")intLineNum = 0' ------------------------------------' Set Set Font Settings' ------------------------------------' Make sure we were sent a good line widthIf LengthOfLine < 1 Then' Return an ErrorErr.Raise vbObjectError + 605, "Requested Length of Line must be greater than 0"End If' ------------------------------------' Set RegEx Settings' ------------------------------------objRegExp.MultiLine = FalseobjRegExp.Global = True' ------------------------------------' Set the Search Pattern' ------------------------------------' This is the RegEx List for Characters that should be grouped with the text that follows them' ${(<[\ - Have to use escape character "\" for ] and \strStartGroup = "${(<\[\\"' This is the RegEx List for Characters that should be grouped with the text the preceeds them' !)}%>?-] - Have to use escape character "\" for - and ]strEndGroup = "!)}%>?\-\]"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = "[" & strStartGroup & "]?"' Now grab all characters that are not part of special list and no spaces \s' [] = Group. Find Anything listed in this group. + = Find 1 to many instances.' Equates to finding whole words including some special characters (those not in list since negative comparison)strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = strRegPattern & "[" & strEndGroup & "]?"objRegExp.Pattern = strRegPattern' ------------------------------------' Break up Original String into already defined lines' ------------------------------------strLineData = Split(TextToWrap, vbLf)' ------------------------------------' Loop through each line to wrap text if needed' ------------------------------------For Each strLine In strLineData' Reset the Line Position for this set of textintLinePos = 0' Make sure the line is long enough to need to be wrappedIf Len(strLine) > LengthOfLine Then' ------------------------------------' Get the list of words defined by the Pattern' ------------------------------------Set objWordList = objRegExp.Execute(strLine)' ------------------------------------' Build the Return Array' ------------------------------------For Each objWord In objWordList' See if this word is too big to FitIf objWord.Length > LengthOfLine Then' Word is too big for the line, have to break it appart' Reset the Number of Characters used in this word to 1intNumCharUsed = 1' First see if we have any remaining words that should be added to the previous lineIf objWord.FirstIndex - intLinePos > 0 Then' Save Previous LinestrReturn = strReturn & (Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfDo While intNumCharUsed < objWord.Length' Get as many characters as will fit on the linestrReturn = strReturn & (Mid(objWord.Value, intNumCharUsed, LengthOfLine) & vbNewLine)' Reset the Line PositionintLinePos = intLinePos + Len(Mid(objWord.Value, intNumCharUsed, LengthOfLine))' Increase the Number used counterintNumCharUsed = intNumCharUsed + Len(Mid(objWord.Value, intNumCharUsed, LengthOfLine))' Increment our line CounterintLineNum = intLineNum + 1LoopElseIf objWord.FirstIndex - intLinePos + objWord.Length > LengthOfLine Then' This word will not fit on current Line. Save Current LinestrReturn = strReturn & (Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfEnd If 'objWord.Length > LengthOfLineNext' ------------------------------------' See if there is any text yet to add' ------------------------------------If (Len(strLine) - intLinePos) > 0 Then' Save of the Last bits of DatastrReturn = strReturn & (Right(strLine, Len(strLine) - intLinePos) & vbNewLine)' Increment our line CounterintLineNum = intLineNum + 1End IfElse' ------------------------------------' The entire line fits. Add it now' ------------------------------------strReturn = strReturn & (strLine & vbNewLine)' Increment our line CounterintLineNum = intLineNum + 1End IfNext' Return our ArrayWordWrapByCharacterToString = strReturn' Release the ObjectsOn Error Resume NextSet objWordList = NothingSet objWord = NothingSet objRegExp = Nothing End Function

Stage Two:

第二階段:

As I mentioned, the problem with both of the above functions is that they still break based on a character count. ?With propotionalized fonts, though, a line of "iiiiiiiiii" will break differently than a line of "WWWWWWWWWW" in a textbox. ?Since the width of a text box is based on points, the code needed to determine the size of the text in points before it could split the lines. ?There are examples on the internet of using Windows APIs to determine the pixel size of a section of text. ?If you know the DPI of a monitor, which can be had via the APIs, you can determine the point size. ?Adapting those ideas, a class to determine text size was created.

正如我提到的,上述兩個(gè)函數(shù)的問題在于它們?nèi)匀换谧址?jì)數(shù)而中斷。 但是,對于帶比例的字體,文本框中的“ iiiiiiiiii”行與“ WWWWWWWWWW”行的折斷方式不同。 由于文本框的寬度基于點(diǎn),因此需要使用代碼來確定文本的大小(以點(diǎn)為單位),然后才能分割線。 互聯(lián)網(wǎng)上有使用Windows API確定一段文字的像素大小的示例。 如果您知道可以通過API獲得的顯示器的DPI,則可以確定點(diǎn)的大小。 為適應(yīng)這些想法,創(chuàng)建了一個(gè)確定文本大小的類。

This class is used to measure the point size of each word, to compare that with the targeted line width in points, and to see if the word fits that line. ?Pleaset note that the defined width of a text box is not exactly the size needed for your total line width. ?The textbox has margins built into the display. ?I could not find this documented anywhere, but it appears that the margin is 3 points per side (Selection Margin is another 3 if set to true and a displayed scroll bar appears to take up 14). ?Therefore when wrapping text, you need to take the width of the text box and subtract the correct amount (like 6 for just a basic box) to find the width in points that can display text. ?

此類用于測量每個(gè)單詞的點(diǎn)大小,將其與目標(biāo)行寬(以磅為單位)進(jìn)行比較,并查看單詞是否適合該行。 請注意,文本框的定義寬度與總線寬所需的大小不完全相同。 文本框在顯示屏中內(nèi)置了頁邊距。 我在任何地方都找不到此文檔,但是看來邊距是每邊3個(gè)點(diǎn)(如果設(shè)置為true,則“選擇邊距”是另外3個(gè)點(diǎn),并且顯示的滾動(dòng)條似乎占用14個(gè)點(diǎn))。 因此,在自動(dòng)換行時(shí),需要采用文本框的寬度并減去正確的數(shù)量(例如對于基本框來說為6)以找到可以顯示文本的點(diǎn)的寬度。

Since this code requires access to Windows API, VBA must be used. ?Therefore, they have been coded using early binding for regular expressions. ?Please make sure to add a reference in your project to MICROSOFT VBSCRIPT REGULAR EXPRESSION 5.5 to use these functions.

由于此代碼需要訪問Windows API,因此必須使用VBA。 因此,已使用早期綁定對正則表達(dá)式進(jìn)行編碼。 請確保在項(xiàng)目中添加對MICROSOFT VBSCRIPT REGULAR EXPRESSION 5.5的引用,以使用這些功能。

WordWrapByPointToArray Function:

WordWrapByPointToArray函數(shù):

Here is the third attempt at a function. ?To use this function, send it the text that you want word wrapped, the font used, and how wide the line should be in points. ?It will return a string array with each line as a separate element in the array.

這是函數(shù)的第三次嘗試。 要使用此功能,請向其發(fā)送要自動(dòng)換行的文本,使用的字體以及線的寬度(以磅為單位)。 它將返回一個(gè)字符串?dāng)?shù)組,其中每一行作為數(shù)組中的單獨(dú)元素。

Example:

例:

Dim strLines() As String strLines = WordWrapByPointToArray(TextToWrap:=TextBox1.Text, TextFont:=TextBox1.Font, LineWidthInPoints:=TextBox1.Width - 6) For i = 0 To UBound(strLines)Debug.Print strLines(i) Next '--------------------------------------------------------------------------------------- ' Function : WordWrapByPointToArray ' Date : 03/20/2012 ' Purpose : Will Return a String array of line data that has been sepearated into lines ' based on Width in Points and split according to textbox word wrap rules. ' *** MUST have a REFERENCE set for Microsoft VBScript Regular Expression 5.5 ' *** Must also have the DetermineTextSize Class added to the project*** ' ' Usage : Set a string array = to WordWrapByPointToArray sending WordWrapByPointToArray ' your text, Font and Line Width (Point Size) for each line ' Example: ' Dim strLines() as string ' strLines = WordWrapByPointToArray(TextToWrap:=TextBox1.Text, TextFont:=TextBox1.Font, LineWidthInPoints:=TextBox1.Width - 6) ' This will break the string into multiple lines at the same point as the text box ' ' Please note in the example I take 6 away form TextBox1.Width as this appears to be ' the margin size of a text box. I found this through trial and error and have not ' been able to verify that value. '--------------------------------------------------------------------------------------- ' Public Function WordWrapByPointToArray(ByVal TextToWrap As String, _ByVal TextFont As StdFont, ByVal LineWidthInPoints As Single) As String()On Error GoTo WordWrapByPointToArray_Error:Dim objRegExp As VBScript_RegExp_55.RegExpDim objWordList As VBScript_RegExp_55.MatchCollectionDim objWord As VBScript_RegExp_55.MatchDim udtTextSize As DetermineTextSizeDim strStartGroup As StringDim strEndGroup As StringDim strRegPattern As StringDim intLineNum As Integer: intLineNum = 0Dim intLinePos As IntegerDim intEndPosition As IntegerDim strReturn() As StringDim strLineData() As StringDim strLine As VariantDim lngPointSize As LongDim lngWordSize As LongDim intNumCharUsed As Integer' Instantiate RegExSet objRegExp = New VBScript_RegExp_55.RegExpSet udtTextSize = New DetermineTextSize' ------------------------------------' Set Set Font Settings' ------------------------------------' Make sure we were sent a good line widthIf LineWidthInPoints < 1 Then' Return an ErrorErr.Raise Number:=vbObjectError + 605, Description:="Requested Line Width in Points must be greater than 0"End If' ------------------------------------' Set Set Font Settings' ------------------------------------udtTextSize.Font = TextFont' ------------------------------------' Set RegEx Settings' ------------------------------------objRegExp.MultiLine = FalseobjRegExp.Global = True' ------------------------------------' Set the Search Pattern' ------------------------------------' This is the RegEx List for Characters that should be grouped with the text that follows them' ${(<[\ - Have to use escape character "\" for ] and \strStartGroup = "${(<\[\\"' This is the RegEx List for Characters that should be grouped with the text the preceeds them' !)}%>?-] - Have to use escape character "\" for - and ]strEndGroup = "!)}%>?\-\]"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = "[" & strStartGroup & "]?"' Now grab all characters that are not part of special list and no spaces \s' [] = Group. Find Anything listed in this group. + = Find 1 to many instances.' Equates to finding whole words including some special characters (those not in list since negative comparison)strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = strRegPattern & "[" & strEndGroup & "]?"objRegExp.Pattern = strRegPattern' ------------------------------------' Break up Original String into already defined lines' ------------------------------------strLineData = Split(TextToWrap, vbLf)' ------------------------------------' Set Original Size of Return Array to just one line. Can Expand Later' ------------------------------------ReDim Preserve strReturn(0)' ------------------------------------' Loop through each line to wrap text if needed' ------------------------------------For Each strLine In strLineData' Reset the Line Position for this set of textintLinePos = 0' Make sure the line is long enough to need to be wrappedIf udtTextSize.TextWidthinPoints(strLine) > LineWidthInPoints Then' ------------------------------------' Get the list of words defined by the Pattern' ------------------------------------Set objWordList = objRegExp.Execute(strLine)' ------------------------------------' Build the Return Array' ------------------------------------For Each objWord In objWordListlngWordSize = udtTextSize.TextWidthinPoints(objWord.Value)' See if this word is too big to FitIf lngWordSize > LineWidthInPoints Then' Word is too big for the line, have to break it appart' Reset the Number of Characters used in this word to 0intNumCharUsed = 0' First see if we have any remaining words that should be added to the previous lineIf objWord.FirstIndex - intLinePos > 0 Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Save Previous LinestrReturn(intLineNum) = Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IflngPointSize = lngWordSize' Keep Looping until remaining text will fit on a line by itselfDo While lngPointSize > LineWidthInPoints' Calculate the new end Length (Try to get close to needed end so it does not loop too long)If (objWord.Length - intNumCharUsed) > 10 Then' Set our attempted end position. Figure out how much of the word we have left' and then take the percentage of that. The precantage being how far over' the line width we areintEndPosition = intLinePos + ((objWord.Length - intNumCharUsed) / CInt(lngPointSize / LineWidthInPoints))Else' We don't have too many characters Left so just go at them one at a timeintEndPosition = intLinePos + (objWord.Length - intNumCharUsed)End If' Recalculate the lengthlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, intEndPosition - intLinePos))If lngPointSize <= LineWidthInPoints Then' Keep Looping until we are one past it fitting on the lineDo While lngPointSize <= LineWidthInPoints' This character would still fit, add one more characterintEndPosition = intEndPosition + 1' Recalculate the lengthlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, intEndPosition - intLinePos))Loop' Take away the one extra character to go back to the last one that fitintEndPosition = intEndPosition - 1Else' Still too big' Keep removing one character until it fitsDo While lngPointSize > LineWidthInPoints' Did not fit, go back one characterintEndPosition = intEndPosition - 1' Recalculate the lengthlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, intEndPosition - intLinePos))LoopEnd If' Calculate how many characters were addedintNumCharUsed = intNumCharUsed + (intEndPosition - intLinePos)' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Since we made it this far, we know this text fits. Add it nowstrReturn(intLineNum) = Mid(strLine, intLinePos + 1, intEndPosition - intLinePos)' Reset the Line PositionintLinePos = intEndPosition' Increment our line CounterintLineNum = intLineNum + 1' Now Calculate how big the next line is when we add the remaining text and try againlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos + objWord.Length))LoopElse' This word is smaller than the line width. Check the width if we add itlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos + objWord.Length))If lngPointSize > LineWidthInPoints Then' It did not fit. Add previous text to array' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' This word will not fit on current Line. Save Current LinestrReturn(intLineNum) = Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfEnd IfNext' ------------------------------------' See if there is any text yet to add' ------------------------------------If (Len(strLine) - intLinePos) > 0 Then' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End If' Save of the Last bits of DatastrReturn(intLineNum) = Right(strLine, Len(strLine) - intLinePos)' Increment our line CounterintLineNum = intLineNum + 1End IfElse' ------------------------------------' The entire line fits. Add it now' ------------------------------------' See if we need to expand the arrayIf UBound(strReturn) < intLineNum Then' ReDim the ArrayReDim Preserve strReturn(intLineNum)End IfstrReturn(intLineNum) = strLine' Increment our line CounterintLineNum = intLineNum + 1End IfNext' Return our ArrayWordWrapByPointToArray = strReturnRelease:On Error Resume NextErase strReturnSet udtTextSize = NothingSet objWordList = NothingSet objWord = NothingSet objRegExp = NothingExit FunctionWordWrapByPointToArray_Error:MsgBox "Procedure = WordWrapByPointToArray" & vbCrLf & _"Error Number = " & Err.Number & vbCrLf & _"Error Message = " & Err.Description & vbCrLf, _vbCritical Or vbSystemModal, "Word Wrap Error"Resume Release: End Function

WordWrapByPointToString Function

WordWrapByPointToString函數(shù)

Here is the fourth attempt at a function. ?To use this function, send it the text that you want word wrapped, the font used, and how wide the line should be in points. ?It will return a single string with each line in the string separated by a carriage return.

這是功能的第四次嘗試。 要使用此功能,請向其發(fā)送要自動(dòng)換行的文本,使用的字體以及線的寬度(以磅為單位)。 它將返回單個(gè)字符串,字符串中的每一行都用回車符分隔。

Example:

例:

Dim strWrappedLines As String strWrappedLines = WordWrapByPointToString(TextToWrap:=TextBox1.Text, TextFont:=TextBox1.Font, LineWidthInPoints:=TextBox1.Width - 6) Debug.Print strWrappedLines '--------------------------------------------------------------------------------------- ' Function : WordWrapByPointToString ' Date : 03/20/2012 ' By : Barry Versaw ' Purpose : Will Return a String of data that has been sepearated into lines ' based on Width in Points and split according to textbox word wrap rules. ' Each line is separated by a carriage return & line feed ' *** MUST have a REFERENCE set for Microsoft VBScript Regular Expression 5.5 ' *** Must also have the DetermineTextSize Class added to the project*** ' ' Usage : Set a string array = to WordWrapByPointToString sending WordWrapByPointToString ' your text, Font and Line Width (Point Size) for each line ' Example: ' Dim strWrappedLines as string ' strWrappedLines = WordWrapByPointToString(TextToWrap:=TextBox1.Text, TextFont:=TextBox1.Font, LineWidthInPoints:=TextBox1.Width - 6) ' This will break the string into multiple lines at the same point as the text box ' ' Please note in the example I take 6 away form TextBox1.Width as this appears to be ' the margin size of a text box. I found this through trial and error and have not ' been able to verify that value. '--------------------------------------------------------------------------------------- ' Public Function WordWrapByPointToString(ByVal TextToWrap As String, _ByVal TextFont As StdFont, ByVal LineWidthInPoints As Single) As StringOn Error GoTo WordWrapByPointToString_Error:Dim objRegExp As VBScript_RegExp_55.RegExpDim objWordList As VBScript_RegExp_55.MatchCollectionDim objWord As VBScript_RegExp_55.MatchDim udtTextSize As DetermineTextSizeDim strStartGroup As StringDim strEndGroup As StringDim strRegPattern As StringDim intLineNum As Integer: intLineNum = 0Dim intLinePos As IntegerDim intEndPosition As IntegerDim strReturn As StringDim strLineData() As StringDim strLine As VariantDim lngPointSize As LongDim lngWordSize As LongDim intNumCharUsed As Integer' Instantiate RegExSet objRegExp = New VBScript_RegExp_55.RegExpSet udtTextSize = New DetermineTextSize' ------------------------------------' Set Set Font Settings' ------------------------------------' Make sure we were sent a good line widthIf LineWidthInPoints < 1 Then' Return an ErrorErr.Raise Number:=vbObjectError + 605, Description:="Requested Line Width in Points must be greater than 0"End If' ------------------------------------' Set Set Font Settings' ------------------------------------udtTextSize.Font = TextFont' ------------------------------------' Set RegEx Settings' ------------------------------------objRegExp.MultiLine = FalseobjRegExp.Global = True' ------------------------------------' Set the Search Pattern' ------------------------------------' This is the RegEx List for Characters that should be grouped with the text that follows them' ${(<[\ - Have to use escape character "\" for ] and \strStartGroup = "${(<\[\\"' This is the RegEx List for Characters that should be grouped with the text the preceeds them' !)}%>?-] - Have to use escape character "\" for - and ]strEndGroup = "!)}%>?\-\]"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = "[" & strStartGroup & "]?"' Now grab all characters that are not part of special list and no spaces \s' [] = Group. Find Anything listed in this group. + = Find 1 to many instances.' Equates to finding whole words including some special characters (those not in list since negative comparison)strRegPattern = strRegPattern & "[^\s" & strStartGroup & strEndGroup & "]+"' [] = Group. Find Anything listed in this group. ? = Find 0 to 1 instancesstrRegPattern = strRegPattern & "[" & strEndGroup & "]?"objRegExp.Pattern = strRegPattern' ------------------------------------' Break up Original String into already defined lines' ------------------------------------strLineData = Split(TextToWrap, vbLf)' ------------------------------------' Loop through each line to wrap text if needed' ------------------------------------For Each strLine In strLineData' Reset the Line Position for this set of textintLinePos = 0' Make sure the line is long enough to need to be wrappedIf udtTextSize.TextWidthinPoints(strLine) > LineWidthInPoints Then' ------------------------------------' Get the list of words defined by the Pattern' ------------------------------------Set objWordList = objRegExp.Execute(strLine)' ------------------------------------' Build the Return Array' ------------------------------------For Each objWord In objWordListlngWordSize = udtTextSize.TextWidthinPoints(objWord.Value)' See if this word is too big to FitIf lngWordSize > LineWidthInPoints Then' Word is too big for the line, have to break it appart' Reset the Number of Characters used in this word to 0intNumCharUsed = 0' First see if we have any remaining words that should be added to the previous lineIf objWord.FirstIndex - intLinePos > 0 Then' Save Previous LinestrReturn = strReturn & (Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IflngPointSize = lngWordSize' Keep Looping until remaining text will fit on a line by itselfDo While lngPointSize > LineWidthInPoints' Calculate the new end Length (Try to get close to needed end so it does not loop too long)If (objWord.Length - intNumCharUsed) > 10 Then' Set our attempted end position. Figure out how much of the word we have left' and then take the percentage of that. The precantage being how far over' the line width we areintEndPosition = intLinePos + ((objWord.Length - intNumCharUsed) / CInt(lngPointSize / LineWidthInPoints))Else' We don't have too many characters Left so just go at them one at a timeintEndPosition = intLinePos + (objWord.Length - intNumCharUsed)End If' Recalculate the lengthlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, intEndPosition - intLinePos))If lngPointSize <= LineWidthInPoints Then' Keep Looping until we are one past it fitting on the lineDo While lngPointSize <= LineWidthInPoints' This character would still fit, add one more characterintEndPosition = intEndPosition + 1' Recalculate the lengthlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, intEndPosition - intLinePos))Loop' Take away the one extra character to go back to the last one that fitintEndPosition = intEndPosition - 1Else' Still too big' Keep removing one character until it fitsDo While lngPointSize > LineWidthInPoints' Did not fit, go back one characterintEndPosition = intEndPosition - 1' Recalculate the lengthlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, intEndPosition - intLinePos))LoopEnd If' Calculate how many characters were addedintNumCharUsed = intNumCharUsed + (intEndPosition - intLinePos)' Since we made it this far, we know this text fits. Add it nowstrReturn = strReturn & (Mid(strLine, intLinePos + 1, intEndPosition - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = intEndPosition' Increment our line CounterintLineNum = intLineNum + 1' Now Calculate how big the next line is when we add the remaining text and try againlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos + objWord.Length))LoopElse' This word is smaller than the line width. Check the width if we add itlngPointSize = udtTextSize.TextWidthinPoints(Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos + objWord.Length))If lngPointSize > LineWidthInPoints Then' It did not fit. Add previous text to array' This word will not fit on current Line. Save Current LinestrReturn = strReturn & (Mid(strLine, intLinePos + 1, objWord.FirstIndex - intLinePos) & vbNewLine)' Reset the Line PositionintLinePos = objWord.FirstIndex' Increment our line CounterintLineNum = intLineNum + 1End IfEnd IfNext' ------------------------------------' See if there is any text yet to add' ------------------------------------If (Len(strLine) - intLinePos) > 0 Then' Save of the Last bits of DatastrReturn = strReturn & (Right(strLine, Len(strLine) - intLinePos) & vbNewLine)' Increment our line CounterintLineNum = intLineNum + 1End IfElse' ------------------------------------' The entire line fits. Add it now' ------------------------------------strReturn = strReturn & (strLine & vbNewLine)' Increment our line CounterintLineNum = intLineNum + 1End IfNext' Return our StringWordWrapByPointToString = strReturnRelease:On Error Resume NextSet udtTextSize = NothingSet objWordList = NothingSet objWord = NothingSet objRegExp = NothingExit FunctionWordWrapByPointToString_Error:MsgBox "Procedure = WordWrapByPointToString" & vbCrLf & _"Error Number = " & Err.Number & vbCrLf & _"Error Message = " & Err.Description & vbCrLf, _vbCritical Or vbSystemModal, "Word Wrap Error"Resume Release: End Function

DetermineTextSize Class

確定文本大小類

Both of the above functions require the following code to be added as a class to your project. ?Please name the class DetermineTextSize. ?To add a class, on the menu click Insert >>?Class Module. ?Then in the properties change the name to DetermineTextSize. ?Then in the code window paste the following code:

以上兩個(gè)功能都需要將以下代碼作為類添加到您的項(xiàng)目中。 請將該類命名為DefineTextSize。 要添加類,請?jiān)诓藛紊蠁螕舨迦?gt;>類模塊。 然后在屬性中將名稱更改為確定文本大小。 然后在代碼窗口中粘貼以下代碼:

'--------------------------------------------------------------------------------------- ' Class : DetermineTextSize ' PURPOSE : This class accepts a font and the determines the size of the passed text. ' It can return the Text Height or Width in Pixels or ' The Text Height or Width in Points ' ' This code is adapted from several posts on the web '-----------------------Option Explicit' Declare all Needed Windows Constants Private Const LF_FACESIZE = 32 Private Const LOGPIXELSY = 90 Private Const LOGPIXELSX = 88 Private Const DT_CALCRECT = &H400' See - http://msdn.microsoft.com/en-us/library/dd145037%28v=vs.85%29.aspx Private Type udtLogFontlfHeight As LonglfWidth As LonglfEscapement As LonglfOrientation As LonglfWeight As LonglfItalic As BytelfUnderline As BytelfStrikeOut As BytelfCharSet As BytelfOutPrecision As BytelfClipPrecision As BytelfQuality As BytelfPitchAndFamily As BytelfFaceName(LF_FACESIZE) As Byte End TypePrivate Type udtTextSizeWidth As LongHeight As Long End TypePrivate Declare Function GetTextExtentPoint Lib "gdi32" _Alias "GetTextExtentPointA" (ByVal hDC As Long, _ByVal lpszString As String, ByVal cbString As Long, _lpSIZE32 As udtTextSize) As LongPrivate Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" _(ByRef lpudtLogFont As udtLogFont) As LongPrivate Declare Function GetDC Lib "user32.dll" _(ByVal hWnd As Long) As LongPrivate Declare Function ReleaseDC Lib "user32.dll" _(ByVal hWnd As Long, ByVal hDC As Long) As LongPrivate Declare Function MulDiv Lib "kernel32" ( _ByVal nNumber As Long, ByVal nNumerator As Long, _ByVal nDenominator As Long) As LongPrivate Declare Function DeleteObject Lib "gdi32" _(ByVal hObject As Long) As LongPrivate Declare Function GetDeviceCaps Lib "gdi32" _(ByVal hDC As Long, ByVal nIndex As Long) As LongPrivate Declare Function SelectObject Lib "gdi32" _(ByVal hDC As Long, ByVal hObject As Long) As LongPrivate m_objFont As StdFont ' Store Font Settings to be used for calculations Private m_hDeviceContext As Long ' Store the handler for the Device Context Private m_intDPIWidth As Integer ' Store the DPI Width - just calculate once Private m_intDPIHeight As Integer ' Store the DPI Height - just calculate once'--------------------------------------------------------------------------------------- ' Procedure : Class_Initialize ' Purpose : Class has been Declared. Set Default Values '--------------------------------------------------------------------------------------- ' Private Sub Class_Initialize()' Instantiate the Font ObjectSet m_objFont = New StdFont' Get Access to A Device Context for the general screenm_hDeviceContext = GetDC(0)' Grab the Screen DPI Settingsm_intDPIWidth = GetDeviceCaps(m_hDeviceContext, LOGPIXELSX)m_intDPIHeight = GetDeviceCaps(m_hDeviceContext, LOGPIXELSY) End Sub'--------------------------------------------------------------------------------------- ' Procedure : Class_Terminate ' Purpose : Class is being Destroyed. Release objects '--------------------------------------------------------------------------------------- ' Private Sub Class_Terminate()Set m_objFont = NothingEnd Sub'--------------------------------------------------------------------------------------- ' Property : Font ' Purpose : Gets & Lets the Font to be used in sizing the text '--------------------------------------------------------------------------------------- ' Public Property Get Font() As StdFontFont = m_objFontReleaseDC 0, m_hDeviceContextEnd PropertyPublic Property Let Font(ByVal FontValue As StdFont)Set m_objFont = FontValueEnd Property'--------------------------------------------------------------------------------------- ' Procedure : TextHeightInPixels ' Purpose : Returns the Height of sent text in pixels '--------------------------------------------------------------------------------------- Public Function TextHeightInPixels(ByVal TextToEvaluate As String) As LongDim udtSize As udtTextSize' Get the Size of the Text in Height & WidthudtSize = GetSizeOfText(TextToEvaluate)' .Bottom Returns how high the rectangle is in pixelsTextHeightInPixels = udtSize.Height End Function'--------------------------------------------------------------------------------------- ' Procedure : TextHeightInPoints ' Purpose : Returns the Height of sent text in Points '--------------------------------------------------------------------------------------- Public Function TextHeightInPoints(ByVal TextToEvaluate As String) As LongDim udtSize As udtTextSize' Get the Size of the Text in Height & WidthudtSize = GetSizeOfText(TextToEvaluate)' .Bottom Returns how high the rectangle is in pixels' Pionts = Pixels * 72 / DPI : 72 Points Per Inch' Use MulDiv to avoid potential overflow errorTextHeightInPoints = MulDiv(udtSize.Height, 72, m_intDPIHeight)End Function'--------------------------------------------------------------------------------------- ' Procedure : TextWidthInPixels ' Purpose : Returns the width of sent text in pixels. If the text has ' multiple lines, it returns the width of the widest line. '--------------------------------------------------------------------------------------- Public Function TextWidthInPixels(ByVal TextToEvaluate As String) As LongDim udtSize As udtTextSize' Get the Size of the Text in Height & WidthudtSize = GetSizeOfText(TextToEvaluate)' Width is the Right Dimension of the RectangleTextWidthInPixels = udtSize.WidthEnd Function'--------------------------------------------------------------------------------------- ' Procedure : TextWidthInPoints ' Purpose : Returns the width of sent text in Points. If the text has ' multiple lines, it returns the width of the widest line. '--------------------------------------------------------------------------------------- Public Function TextWidthinPoints(ByVal TextToEvaluate As String) As LongDim udtSize As udtTextSize' Get the Size of the Text in Height & WidthudtSize = GetSizeOfText(TextToEvaluate)' Width is the Right Dimension of the Rectangle' Pionts = Pixels * 72 / DPI : 72 Points Per Inch' Use MulDiv to avoid potential overflow errorTextWidthinPoints = MulDiv(udtSize.Width, 72, m_intDPIWidth)End Function'--------------------------------------------------------------------------------------- ' Procedure : GetudtTextSize ' Purpose : Gets udtLogFont size of a string and returns it as ' Width ane Length Dimension '--------------------------------------------------------------------------------------- ' Private Function GetSizeOfText(ByVal TextToSize As String) As udtTextSizeDim udtFont As udtLogFontDim hFont As Long ' Handle to a Logical FontDim hOldFont As Long ' Handle to a Logcial FontDim udtReturnDims As udtTextSize' Convert the stdFont to a udtLogFont for use in drawing the RectangleudtFont = OLEFontToLogFont(m_objFont)' Create a temporary Font to draw the RectanglehFont = CreateFontIndirect(udtFont)' Store the Current Font to put back when donehOldFont = SelectObject(m_hDeviceContext, hFont)' Draw the RectangleGetTextExtentPoint m_hDeviceContext, TextToSize, Len(TextToSize), udtReturnDims' Put the Original Font Back in PlaceSelectObject m_hDeviceContext, hOldFont' Delete our Temporary FontDeleteObject hFont' Return the DimensionsGetSizeOfText = udtReturnDimsEnd Function'--------------------------------------------------------------------------------------- ' Procedure : OLEFontToLogFont ' Purpose : Converts an OLE stdFont to a udtLogFont '--------------------------------------------------------------------------------------- Private Function OLEFontToLogFont(ByVal FontToConvert As StdFont) As udtLogFontDim strFont As StringDim intChar As IntegerDim bytFont() As ByteWith OLEFontToLogFontstrFont = FontToConvert.NamebytFont = StrConv(strFont, vbFromUnicode)For intChar = 0 To Len(strFont) - 1.lfFaceName(intChar) = bytFont(intChar)Next intChar' Convert Height from Points to Pixels' Use MulDiv to avoid potential overflow error.lfHeight = -MulDiv(FontToConvert.Size, m_intDPIHeight, 72).lfItalic = FontToConvert.Italic.lfWeight = FontToConvert.Weight.lfUnderline = FontToConvert.Underline.lfStrikeOut = FontToConvert.Strikethrough.lfCharSet = FontToConvert.CharsetEnd WithEnd Function

翻譯自: https://www.experts-exchange.com/articles/10064/The-end-of-a-pilgrimage-to-find-a-more-robust-WordWrap-function.html

一個(gè)人的朝圣深度感悟

總結(jié)

以上是生活随笔為你收集整理的一个人的朝圣深度感悟_朝圣之末找到更强大的WordWrap函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

91爱爱电影| 夜夜爽夜夜操 | 亚洲综合激情网 | 天天操夜夜干 | av久久在线 | www99精品| 99精品一区| 一区二区三区免费网站 | 成人免费观看在线视频 | 久久在线电影 | 成人9ⅰ免费影视网站 | 亚洲视频在线免费看 | 日韩理论在线观看 | 黄色一级影院 | 国产亚洲精品久久久久久久久久 | www.eeuss影院av撸 | 91在线观看视频 | 国产精品久久久久久久久久妇女 | 手机av永久免费 | 九九久久婷婷 | 日韩区视频 | 99久久久成人国产精品 | 国产又粗又猛又爽 | 91九色在线观看视频 | 欧美日韩高清在线观看 | 免费网站色 | 二区三区在线 | 国产+日韩欧美 | 中文字幕在线第一页 | 欧美一区二区三区特黄 | 国产99精品在线观看 | 丝袜网站在线观看 | 天天干,天天操 | 天堂av网址 | 国产在线观看黄 | 在线观看亚洲精品视频 | 99免费在线观看视频 | 亚洲国产日韩一区 | 日韩免费视频观看 | 久久久九色精品国产一区二区三区 | 成人在线免费视频观看 | 日本中文字幕视频 | 亚洲欧美va | 91在线亚洲 | 亚洲国产欧洲综合997久久, | 亚洲国产三级 | 色丁香婷婷 | 色五婷婷 | 97超碰人人干 | 免费一级片在线观看 | 久久99热这里只有精品国产 | 激情久久久久久久久久久久久久久久 | 欧美 日韩 国产 成人 在线 | 免费精品人在线二线三线 | 午夜免费福利视频 | 91精品国产麻豆国产自产影视 | 免费中文字幕在线观看 | 在线亚洲免费视频 | 精品国产免费观看 | 六月久久婷婷 | 最新av网址在线观看 | av大全在线观看 | 欧美日韩免费网站 | 免费久久精品视频 | 欧美精品在线一区 | 亚洲v精品 | 99精品亚洲 | 欧美黄色特级片 | 国产视频欧美视频 | 久久国产精品二国产精品中国洋人 | 香蕉视频免费看 | 久久久久久久久影视 | 五月天久久激情 | 国产精品99久久久久的智能播放 | 欧美一二区视频 | 一级欧美日韩 | 成人免费在线网 | 久久久久久久久久久网站 | 免费视频久久久久久久 | 国产涩涩在线观看 | 超碰免费av| 免费在线观看av片 | 日韩欧美网址 | 97精品视频在线播放 | 中文在线a天堂 | 亚洲欧美日本A∨在线观看 青青河边草观看完整版高清 | 久久精品成人热国产成 | 亚洲精品动漫久久久久 | 99久久99久久免费精品蜜臀 | 久久免费的视频 | 三级黄色a | 中文字幕亚洲欧美日韩2019 | 天天综合网天天综合色 | 国产中出在线观看 | 西西4444www大胆视频 | 99精品一级欧美片免费播放 | 欧美日韩一级久久久久久免费看 | 91在线日韩 | 手机在线日韩视频 | adn—256中文在线观看 | 97免费 | 婷婷色资源 | 成人在线播放视频 | 亚洲精品美女在线观看播放 | 国产精品福利午夜在线观看 | 96香蕉视频| 亚洲精品欧洲精品 | 最近在线中文字幕 | 五月天久久综合网 | 9在线观看免费高清完整 | 乱男乱女www7788 | 亚洲影视九九影院在线观看 | 欧美激情精品久久久久 | 中文字幕资源网在线观看 | 精品久久久久久综合 | 欧美精品视 | 日韩黄色影院 | 最新动作电影 | 一区二区三区日韩精品 | 中文字幕.av.在线 | 精品人人人人 | 成人av电影在线播放 | 91精品视频在线播放 | 国产69精品久久99的直播节目 | 亚洲美女在线国产 | 精品亚洲免a| 操操操日日日 | 日韩欧美一区视频 | 久久经典国产视频 | 97精品超碰一区二区三区 | 激情五月***国产精品 | 中文字幕在线视频一区 | 最近字幕在线观看第一季 | 久久国产高清 | 在线有码中文字幕 | 亚洲成人黄色在线观看 | 中文字幕制服丝袜av久久 | 91视频免费视频 | 国内一区二区视频 | 日韩三级视频在线看 | 精品在线观看一区二区 | 国产又粗又猛又爽又黄的视频免费 | 亚欧洲精品视频在线观看 | 成人黄色免费观看 | 免费91麻豆精品国产自产在线观看 | 国产色黄网站 | 久久精品欧美一区 | 国产成人高清av | 最新国产视频 | 久久综合99| 91精品视频在线看 | 国产手机在线播放 | 国产一区二区成人 | 最近2019好看的中文字幕免费 | 大片网站久久 | www国产精品com | 亚洲国产成人高清精品 | 国产精品专区一 | 激情大尺度视频 | 国产精品成人一区二区三区吃奶 | 国产中文欧美日韩在线 | 色诱亚洲精品久久久久久 | 亚洲成人软件 | 高清中文字幕av | 人人插人人费 | 亚洲精品国产精品国 | 日韩在线观看你懂得 | 免费黄av| 国产精品免费久久久久久久久久中文 | 久久综合狠狠狠色97 | 视频二区在线视频 | 久章草在线 | av高清一区二区三区 | 精品免费视频 | 免费亚洲一区二区 | 日本久久免费电影 | 日日夜夜天天久久 | 成在线播放 | 日本中文字幕在线一区 | 色综合久久中文综合久久牛 | 97精品国产手机 | 88av网站| 丰满少妇对白在线偷拍 | 国产精品1区2区 | 成年人视频免费在线播放 | 日韩av图片| av免费在线观 | 亚洲国产福利视频 | 欧美日韩性 | 九九精品毛片 | 99免费观看视频 | 国产精品ⅴa有声小说 | 2017狠狠干| 亚洲国产精品电影在线观看 | 精品久久九九 | 国产精品 视频 | 国产特级毛片aaaaaa毛片 | 日韩免费一区二区在线观看 | 免费在线| 国产码电影| 日韩欧美xxxx| 亚洲国产丝袜在线观看 | 日韩精品一区二 | 高潮久久久久久久久 | 丁香六月婷 | 免费在线观看av网址 | 日本精品午夜 | 中文字幕国内精品 | 蜜臀av在线一区二区三区 | 91免费版在线 | 91成人免费观看视频 | 在线日韩| 国产粉嫩在线观看 | 天堂av在线免费 | 亚洲精品在线免费观看视频 | 久热爱| 欧美最新另类人妖 | 黄色片网站av | 992tv成人免费看片 | 四虎影视国产精品免费久久 | 成人毛片久久 | 国产精品对白一区二区三区 | 日本婷婷色 | 国产精品福利无圣光在线一区 | 久草热视频 | 欧美少妇xx| 国产精品免费视频久久久 | 精品99在线视频 | 久久99国产一区二区三区 | 天天干天天干天天干天天干天天干天天干 | 国内精品视频在线播放 | 国产喷水在线 | 欧美aaa级片| 手机看片福利 | 日韩专区在线观看 | 欧美亚洲另类在线视频 | 国产精品一区在线观看你懂的 | 色多多视频在线 | free. 性欧美.com| 九七人人干 | 美女网站视频免费都是黄 | 婷婷丁香激情五月 | 国内精品视频一区二区三区八戒 | 国产理论在线 | 免费精品在线观看 | 亚洲欧美日韩不卡 | 在线电影91| 中文综合在线 | 69精品人人人人 | 欧美在线a视频 | 国产精品丝袜久久久久久久不卡 | 国产精品成人国产乱一区 | 一级黄色片在线观看 | 欧美做受高潮 | 成人aⅴ视频 | 国产精品av在线 | 亚洲h在线播放在线观看h | 91在线蜜桃臀| 天天干,天天射,天天操,天天摸 | 国产精品资源网 | 亚洲精品啊啊啊 | 久草在线视频国产 | 色婷婷97 | 在线观看的黄色 | 免费观看一区二区三区视频 | 1区2区视频| 欧美日韩在线免费观看 | 免费在线观看午夜视频 | 国产精品毛片一区视频播 | 蜜臀av性久久久久蜜臀aⅴ四虎 | 久久综合给合久久狠狠色 | 欧美影片 | 美女视频免费一区二区 | 黄色毛片大全 | 精品国产乱码久久久久久三级人 | 日韩精品专区在线影院重磅 | 911久久香蕉国产线看观看 | 操操操天天操 | 天天天色综合a | 久久精品日产第一区二区三区乱码 | 国产成人免费 | 日本中文字幕观看 | 国产精品久久在线 | 精品国产乱码久久久久久1区二区 | 婷婷激情网站 | 天天躁日日躁狠狠躁av中文 | 九九精品在线观看 | 这里只有精品视频在线观看 | 麻豆影视在线观看 | 精品久久1| 808电影 | 久久免费播放 | 日本黄色黄网站 | 欧美性春潮 | 九九精品视频在线观看 | 五月天婷婷在线观看视频 | 伊甸园av在线 | 怡红院成人在线 | 99视频精品在线 | 天天天干| 99久久精品免费看 | 欧美视频网址 | www.天堂av| 日韩高清在线一区二区 | 日精品 | 在线观看免费版高清版 | 精品久久精品久久 | 亚洲成a人片77777kkkk1在线观看 | 丁香婷婷在线观看 | 色就干| 久草精品国产 | 国产精品久久久久婷婷 | 九色视频网址 | 亚洲成熟女人毛片在线 | 视频三区 | 操操操操网 | 伊人久久婷婷 | 久久伊人婷婷 | 狠狠色狠狠综合久久 | www.com久久久 | av不卡免费看| 国产精品av久久久久久无 | 91精品导航 | 丁香久久五月 | 深爱激情五月综合 | 久久久人人人 | 成人午夜在线电影 | 成人a大片| 99在线精品免费视频九九视 | 手机av片 | 欧美日韩精品免费观看视频 | 成年人在线观看免费视频 | 国产3p视频 | 最新日本中文字幕 | 精品国产视频一区 | 亚洲开心色 | 国产视频一区二区在线播放 | 欧美日韩在线网站 | 日韩亚洲国产精品 | 久久国产精品影片 | 中文永久免费观看 | 欧美影片 | 国产午夜精品视频 | av丝袜天堂 | 国产精品美女久久久 | 探花视频免费观看高清视频 | 97超碰免费在线观看 | 中文字幕免费看 | 日韩在线视频一区 | 久久精品视频网站 | 精品高清美女精品国产区 | 久久国产99 | 天天草天天摸 | 97精品国产97久久久久久 | 亚洲精品视频在线观看免费视频 | www日日夜夜 | 国产成人一区二区三区在线观看 | 99爱精品在线 | 日韩三级成人 | 国产中出在线观看 | 国产区久久 | 91亚洲在线观看 | 国产成人一二片 | 成人a大片 | 99久久日韩精品免费热麻豆美女 | 欧美一区二视频在线免费观看 | 美女精品在线 | 国产一级免费观看 | 日韩在线电影 | 午夜精品久久久久久久99无限制 | 日韩视频免费 | 丁香视频全集免费观看 | 日韩视频在线不卡 | 中文字幕一区二区三 | 91丨九色丨91啦蝌蚪老版 | 国产美女精品在线 | 亚洲一区二区三区毛片 | 国产精品va最新国产精品视频 | 99草在线视频 | 免费观看一级一片 | 亚洲精品视频在线观看免费 | 欧美极品少妇xxxxⅹ欧美极品少妇xxxx亚洲精品 | 欧美日韩免费视频 | 亚州性色| 欧美最猛性xxxx | 久久另类小说 | 一区二区三区观看 | 91精品国产乱码久久桃 | 国产日韩欧美在线免费观看 | 天天操天天舔天天爽 | 欧美一级片在线 | 日韩黄色在线观看 | 亚洲国产精品va在线 | 最新av电影网站 | 亚洲精品一区二区精华 | 久久精品综合一区 | 亚洲精品视频在线观看免费 | 99精品在线免费视频 | 久久视频精品在线观看 | 日韩精品视频免费 | 精品国产一区二区三区久久久蜜月 | 日韩欧美专区 | 97在线观看免费观看 | 国产原创中文在线 | 午夜精品成人一区二区三区 | 91九色视频在线 | 久久精品99北条麻妃 | 久久久麻豆| 在线播放精品一区二区三区 | 美女视频黄的免费的 | 久草资源在线观看 | 天天操天天操天天操天天操天天操 | 曰韩在线 | 国产精品国内免费一区二区三区 | 欧美成人tv | 97免费 | 欧美日韩国产精品一区 | 97超碰国产精品 | 国产精品亚洲视频 | 日本一区二区不卡高清 | 国产亚洲精品福利 | 日韩av网址在线 | 亚洲视频每日更新 | 国产亚洲精品久久久久5区 成人h电影在线观看 | 超碰在线色 | 欧美色噜噜 | 五月婷婷丁香六月 | 91精品国产一区二区三区 | 97成人免费视频 | 91一区二区三区久久久久国产乱 | 就要色综合 | 日韩精品在线观看av | 在线观看视频国产 | 亚洲天天草 | 天天av在线播放 | 国内精品久久久久久久久久清纯 | 国产手机视频 | 亚洲黄色在线看 | 欧美嫩草影院 | 人人爱夜夜操 | 中文字幕在线免费观看视频 | 日本视频网 | 欧美ⅹxxxxxx| 成人午夜电影网 | 成人久久18免费网站麻豆 | 特黄特黄的视频 | 天天操操 | 国产一二三四在线视频 | 玖玖玖影院 | 日日夜夜综合网 | 国产一区二区日本 | 欧洲亚洲国产视频 | 九九热国产视频 | 这里有精品在线视频 | 国产免费又黄又爽 | 黄色软件大全网站 | 欧美日韩xxxxx| 国产免费xvideos视频入口 | 人人cao| 99精品国产99久久久久久福利 | 91麻豆精品国产91久久久久 | 超级碰碰碰免费视频 | 亚洲涩涩色 | 亚洲国产mv| 国产精品二区在线观看 | 久久久影院一区二区三区 | 天天色天天综合网 | 久草在线费播放视频 | 日韩在线免费小视频 | 99国产精品一区二区 | 免费av免费观看 | 国产精品美女免费看 | 右手影院亚洲欧美 | 嫩草91影院 | 最新动作电影 | 精品在线不卡 | 久久99热精品 | 中文字幕在线观看三区 | 香蕉视频网址 | 国产乱老熟视频网88av | 久久激情婷婷 | 人人藻人人澡人人爽 | 久久久久久久免费观看 | 久久天天躁夜夜躁狠狠85麻豆 | 日韩在线第一 | 久艹在线观看视频 | 国产精品午夜久久久久久99热 | 亚洲精品久久激情国产片 | 国产亚洲精品中文字幕 | 日韩精品一区二区不卡 | 精品一区二区视频 | 欧美一区二区三区四区夜夜大片 | 久久人人爽人人片 | 欧美视频一区二 | 日韩精品视频在线免费观看 | 日韩av电影免费在线观看 | 人人添人人 | 毛片网站在线看 | 人人看97 | 亚洲综合狠狠干 | 久久久精品日本 | 午夜性盈盈 | avwww在线观看| 成人91免费视频 | 69久久久久久久 | www狠狠| 国产分类视频 | 免费观看日韩av | 99亚洲精品视频 | 日韩久久精品 | 国产人成精品一区二区三 | 人人爽人人爽人人爽 | 在线日韩亚洲 | 久久视频 | 精品伊人久久久 | 在线观看视频福利 | 日本资源中文字幕在线 | 国产一级电影免费观看 | 奇米影视在线99精品 | 欧美黄色特级片 | 在线观看日韩av | 免费影视大全推荐 | 一区二区三区中文字幕在线 | 中文字幕在线观看视频免费 | 色噜噜日韩精品一区二区三区视频 | 色网站免费在线观看 | 成人丁香花| 国产不卡视频在线播放 | 在线日本v二区不卡 | 午夜精品婷婷 | 久久精品影视 | www.神马久久 | 99视频偷窥在线精品国自产拍 | av黄免费看 | 亚洲精品国产综合久久 | 播五月婷婷| 中文字幕一区在线观看视频 | 久久电影中文字幕视频 | 中文在线最新版天堂 | 一区二区视频免费在线观看 | 国产精品一区二区av | 国产精品久久久久久久电影 | 黄色一级动作片 | 国产精品一区二区62 | 国产成人一二三 | 91精选 | 天天激情天天干 | 国内成人av| 日韩欧美在线中文字幕 | 国产主播大尺度精品福利免费 | 久久这里精品视频 | 国产精品高潮呻吟久久久久 | 久久精视频 | 亚洲欧美国产精品18p | 日日婷婷夜日日天干 | 欧美日韩不卡在线观看 | 9色在线视频 | 精产嫩模国品一二三区 | 国产成人av免费在线观看 | 色婷在线 | 日韩高清在线一区 | 亚洲精品成人在线 | 黄色片网站免费 | 中国一级片在线播放 | 国产精品久久久久影院日本 | 欧美 日韩 性 | 欧美最爽乱淫视频播放 | 91精品免费 | 97人人澡人人添人人爽超碰 | av观看久久久 | 亚洲综合视频在线 | 亚洲黄色精品 | 精品国产一区二区三区久久影院 | 亚洲精品玖玖玖av在线看 | 黄色毛片网站在线观看 | 视频成人 | 国产不卡在线视频 | 91夜夜夜| 成年人视频免费在线播放 | 国产专区免费 | 日韩电影在线观看一区二区 | 免费看成人a | 国产高清亚洲 | 青青河边草观看完整版高清 | 天天操夜夜操 | 伊在线视频 | 91网免费看| 午夜性生活片 | 中文字幕国产视频 | 国产一区二区免费看 | 亚洲国产精品免费 | 在线免费观看视频你懂的 | 亚洲国产成人精品在线观看 | 一区二区三区动漫 | 成人a在线观看 | 99视频国产精品免费观看 | 成人av网站在线播放 | 一区二区在线不卡 | 欧美日韩另类在线 | 久久久受www免费人成 | 在线免费av网站 | 丁香婷婷综合网 | 亚州人成在线播放 | av免费看看| 97色婷婷成人综合在线观看 | 久久亚洲欧美 | 久久久精品二区 | 亚洲成色777777在线观看影院 | 欧美日韩国产亚洲乱码字幕 | 四虎在线永久免费观看 | 午夜精品成人一区二区三区 | 91正在播放| 亚洲精品国产精品99久久 | 亚洲视频 一区 | 欧美一二三四在线 | 99久热精品 | 在线看成人 | 久久精品九色 | 99在线精品免费视频九九视 | 久久国产精品久久久久 | 免费成人av在线看 | 91免费在线看片 | 91看成人| 超级av在线 | 黄色av电影在线观看 | 免费在线观看毛片网站 | 日韩电影在线观看一区 | 日韩在线在线 | av网站免费看 | 日韩,精品电影 | 亚洲精品456在线播放 | 中文字幕乱在线伦视频中文字幕乱码在线 | 久久免费中文视频 | 免费视频成人 | 国产在线2020| 91九色视频网站 | 国产成人久久精品一区二区三区 | 国产在线精品一区二区不卡了 | 久久午夜免费观看 | 香蕉视频在线免费 | 免费网站黄 | 亚洲国产中文字幕在线观看 | 91精品国产91久久久久久三级 | 精品国产电影一区二区 | 狠狠色丁香久久婷婷综合_中 | 亚洲国产午夜精品 | 亚洲视频综合在线 | 97视频网址 | 2019免费中文字幕 | a级片网站 | 九九热中文字幕 | 亚洲精品成人免费 | 国产精品ⅴa有声小说 | 日韩精品aaa | 日韩免费观看视频 | 亚洲国产成人久久综合 | 久久国产亚洲精品 | 色香蕉在线 | 久久99久久99久久 | 久久婷婷五月综合色丁香 | 在线色资源 | 亚洲一区二区视频在线播放 | av看片网址 | 国产视频精品网 | 日日操操 | 黄色的网站免费看 | 最近2019中文免费高清视频观看www99 | 日韩精品网址 | 高清av中文字幕 | 三级av片| 93久久精品日日躁夜夜躁欧美 | 青青久视频 | 久久精品视频在线播放 | 国产精选在线观看 | 麻豆国产精品一区二区三区 | 91中文字幕在线视频 | 中文字幕综合在线 | 国产精品久久久久久吹潮天美传媒 | 亚洲精品午夜久久久 | 亚洲涩涩网站 | 亚洲高清精品在线 | 国产精品成人品 | 婷婷色六月天 | 在线免费观看黄 | 日韩中文在线视频 | 国产精品wwwwww | 九九免费在线视频 | 国产一线二线三线性视频 | 超碰97av在线| 蜜臀aⅴ国产精品久久久国产 | 欧美日韩一级在线 | 国产亚洲免费观看 | 成人丝袜 | 国产精品成久久久久三级 | 国产中出在线观看 | 精品嫩模福利一区二区蜜臀 | 国产免费二区 | 91九色视频导航 | 一级片免费观看 | 婷婷去俺也去六月色 | 日韩精品久久一区二区三区 | 国产黄色特级片 | 久久综合精品一区 | 精品福利国产 | 亚洲欧美日韩国产精品一区午夜 | 在线观看国产亚洲 | a天堂最新版中文在线地址 久久99久久精品国产 | 超碰人人av| 黄色软件网站在线观看 | 欧美一级性 | 午夜a区| 婷婷综合在线 | 久久国产精品免费一区二区三区 | 精品国产视频一区 | 在线观看韩国av | 亚洲国产精品va在线看黑人动漫 | 国产无遮挡又黄又爽馒头漫画 | 天天干天天搞天天射 | 亚洲欧美视频在线 | 色偷偷网站视频 | 精品国偷自产在线 | 日韩精品中文字幕在线不卡尤物 | 日韩视频在线不卡 | 911国产在线观看 | 欧美视频99 | 亚洲高清av在线 | a视频免费看 | 久久久麻豆精品一区二区 | 一区二区三区在线免费观看 | 久久av中文字幕片 | 免费在线观看不卡av | 婷婷丁香在线视频 | 久久超碰在线 | 日韩av免费大片 | 麻豆传媒视频在线播放 | 婷婷.com| 五月天狠狠操 | 人人插人人插 | 婷婷激情在线 | 国产视频久久久 | 免费在线观看av不卡 | 一区在线观看 | 操操操天天操 | 91最新视频在线观看 | 国产成年免费视频 | 天天操天天射天天爽 | av在线播放网址 | 国产精品久久久久久久久毛片 | 免费黄在线观看 | 在线看日韩| 久久色亚洲 | 中文字幕成人在线 | 丁香花在线观看视频在线 | 精壮的侍卫呻吟h | 久久精品久久精品 | 国产资源网 | www色网站 | 五月天丁香视频 | 激情综合色图 | 色婷五月天 | 国产自产高清不卡 | 国产精品久久久久9999 | 国产成人三级三级三级97 | 午夜精品一区二区三区免费 | 97成人精品区在线播放 | 一级片视频免费观看 | 国产资源站 | 国产精品麻豆99久久久久久 | 成人h电影 | 韩日在线一区 | 欧美福利片在线观看 | 欧美在线观看小视频 | 欧美日韩一区二区在线 | 九九欧美视频 | 日韩精品一区电影 | 丁香花在线观看免费完整版视频 | 久久a v电影 | 91成人精品国产刺激国语对白 | 中文字幕在线观看三区 | 国产精品国产三级国产aⅴ入口 | 久久久久久久久久久免费 | 91九色自拍| 天天射天天操天天干 | 久久精品麻豆 | 亚洲婷婷伊人 | 成年人网站免费观看 | 美女黄频免费 | av福利免费| 丁香花在线观看视频在线 | 日韩在线视频免费看 | 中文字幕最新精品 | 久久精品波多野结衣 | 成人一区电影 | 97国产在线观看 | 91九色视频在线播放 | 激情网五月 | 久久久久北条麻妃免费看 | 久久久久综合网 | 天天射天天爽 | 日韩av成人在线观看 | 国产精品日韩久久久久 | www视频在线播放 | 一区二区不卡在线观看 | 国产原创在线视频 | 狂野欧美激情性xxxx | 亚洲精品久久久久中文字幕二区 | 中文字幕一区二区三区四区久久 | 一级黄色网址 | 国产二区电影 | 亚洲1区 在线 | 成人久久18免费网站 | 91视频在线国产 | 国产第一页福利影院 | 亚洲黄色在线免费观看 | 欧美成年人在线视频 | 欧美人zozo| 成人毛片久久 | 国产成人亚洲在线观看 | 在线免费av电影 | 色综合久久精品 | 91精品国产99久久久久久红楼 | 婷婷视频在线播放 | 亚洲免费永久精品国产 | 亚洲国产精彩中文乱码av | 人人搞人人搞 | 国产精品av久久久久久无 | 国内精品小视频 | 天天草综合网 | 毛片一级免费一级 | 91在线免费播放视频 | 色婷婷色 | 亚洲精品欧美精品 | 久久av福利 | 亚洲国产精品成人女人久久 | 香蕉视频日本 | 视频成人免费 | 99色资源 | 成人av播放 | 久久视频二区 | 精品国产一区二区三区久久久 | 六月丁香在线视频 | 在线观看91精品国产网站 | 国产高清区 | 在线观看国产日韩 | 欧美精品一区二区三区一线天视频 | 不卡在线一区 | 中文字幕专区高清在线观看 | 精品综合久久 | 97视频人人免费看 | 在线观看国产亚洲 | 特级西西www44高清大胆图片 | 国产最新精品视频 | 日本精油按摩3 | 丁香花在线观看视频在线 | 91视频91色 | 日韩羞羞 | 亚洲综合狠狠干 | 天天添夜夜操 | 中文字幕在线观看三区 | 国产精品一区二区在线观看 | 国产精品美女久久久久久久久 | 99久在线精品99re8热视频 | 黄色小说免费在线观看 | 日日干天天插 | 韩日电影在线观看 | 91精品一 | 欧美日韩在线播放 | 国产黄a三级三级三级三级三级 | 91试看 | 青草草在线 | 欧美日韩国产一区二区三区 | 国产精品一区二区三区在线 | 国产精品免费视频一区二区 | 精品五月天 | 亚洲色图美腿丝袜 | 久久伦理网 | 波多野结衣一区二区三区中文字幕 | 99久久99久久免费精品蜜臀 | 国产亚洲精品精品精品 | 在线 你懂 | 久久激五月天综合精品 | 成年人免费电影在线观看 | 久草资源免费 | 97精产国品一二三产区在线 | 99精品欧美一区二区蜜桃免费 | 久久久久久欧美二区电影网 | 日韩精品一卡 | 久久久久久久久久久久久9999 | 久久久影片 | 四虎永久免费在线观看 | 久久亚洲二区 | 久久久久免费看 | 性色视频在线 | 特级毛片网站 | 国产精品专区一 | 亚洲精选在线观看 | 国产日本高清 | 中文字幕一区av | 国产主播大尺度精品福利免费 | 人人讲下载 | 国产成人性色生活片 | 日韩欧美视频在线免费观看 | 天天操一操| 精品在线观看一区二区三区 | 黄色免费观看网址 | 日韩免费高清 | 日韩欧美一区二区在线 | 国产精品久久久久久五月尺 | 日韩电影一区二区在线 | 国产 一区二区三区 在线 | 日韩亚洲国产中文字幕 | 狠狠五月天 | 91视频在线播放视频 | 天天插天天射 | 婷婷国产在线 | 综合精品久久 | 亚洲欧美日本一区二区三区 | 欧美久久久久久久久久久久 | 日韩欧美精品一区二区三区经典 | 99热手机在线观看 | 日日夜夜天天久久 | 国产成人高清 | 亚洲精品美女视频 | 超碰人人草人人 | 欧美专区国产专区 | 99精品在线视频观看 | 黄色小说在线免费观看 | 欧美性大胆| 成人av在线网址 | 亚洲精品美女在线观看 | 国产精品一区二区吃奶在线观看 | 久久人人爽爽人人爽人人片av | 成片免费 | 欧美一级片免费 | 国产精品久久久影视 | 91九色视频在线观看 | 香蕉91视频 | 中文字幕一区二区三区精华液 | 国产欧美中文字幕 | 狠狠综合网 | 日韩在线无 | 福利网在线| 日本夜夜草视频网站 | 麻豆影视网站 | 国产精品免费看 | 欧美一二三区在线观看 | 欧美色黄| av日韩精品 | 亚洲精品www久久久 www国产精品com | 欧美日韩国产一区二区三区在线观看 | 在线观看国产高清视频 | 婷五月激情| 精品国产一区二区三区久久久久久 | 国产a级精品 | 日韩在线 | 国产成人区 | 国产网站在线免费观看 | 精品久久久久一区二区国产 | 国产精品黄 | 国产一级片久久 | 中文电影网 | 国产一区在线免费观看 | 久久久久看片 | 欧美日韩国产一二三区 | 麻豆成人小视频 | av在线小说 | 婷婷日韩 | 伊人午夜视频 | 色在线网 | 日韩欧美高清免费 | 一级久久精品 | 国产精品美女久久久久久免费 | 欧美日韩免费观看一区二区三区 | 久久久官网 | 欧美激情一区不卡 | 亚欧洲精品视频在线观看 | 日韩在线不卡视频 | 欧美国产亚洲精品久久久8v | 久久av在线 | 久 久久影院 | 免费成人黄色片 | 国产精品18久久久久久久久 | 天天操天天操天天操天天 | 久久综合电影 | 精品uu | 国内综合精品午夜久久资源 | 99久久国产免费免费 | 久久久国产成人 | 樱空桃av | 天天插天天狠 | 激情欧美丁香 | 激情中文字幕 | 97国产大学生情侣白嫩酒店 | 国产福利精品视频 | 五月天综合激情网 | 国产成人精品一区二 | 国产精品免费一区二区三区 | 色成人亚洲 |