Tooltip for winform dview newline

Source: Internet
Author: User

1. train of thought. Add "\ r \ n" to the string to indicate a line break. You can determine the number of rows based on the total length of the string and several characters in each line.

. Yes newline tooltip

 

Corresponding mainCodeAs follows:

 

Gettooltiptext

1 Private   String Gettooltiptext ( String Originaltext, Int Countperline)
2 {
3 Int Modeint;
4 String Tempstr =   String . Empty;
5 Int Tooltiptextlength = Originaltext. length;
6 Float Linef = ( Float ) Tooltiptextlength / Countperline;
7 Double Line = Math. Ceiling (linef );
8
9 If (Tooltiptextlength > Countperline)
10 {
11 For ( Int I =   0 ; I < Line; I ++ )
12 {
13 Modeint = Tooltiptextlength - I * Countperline;
14 If (Modeint < Countperline)
15 {
16 Tempstr + = Originaltext. substring (I * Countperline, modeint );
17 }
18 Else
19 {
20 Tempstr + = Originaltext. substring (I * Countperline, countperline );
21 Tempstr + =   " \ R \ n " ;
22 }
23 }
24 }
25 Else
26 {
27 Tempstr = Originaltext;
28 }
29 Return Tempstr;
30 }

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.