locked
"wrapping concept" RRS feed

  • Question

  • hi guys,

                   i need to do wrapping concept in my pocket pc .I dont know how to use array concept .help me

     

    Wednesday, September 26, 2007 5:30 AM

Answers

All replies

  • hi , i got size of the pixel using the followig code, but i dont know how to use array concept for text wrapping

     

     

     

    textSize = e.Graphics.MeasureString(measureString, Font)

    txtstr.Text = textSize.Width

    lblWrap.Text = measureString

     

     

     

    Wednesday, September 26, 2007 7:12 AM
  • Say, I had absolutely no idea what you meant by “wrapping concept” and I’ve absolutely no idea what you mean by “array concept”. Consider explaining what you need better, only this way you would get an answer.

    Wednesday, September 26, 2007 6:18 PM
  • hi friend,

          Thanks for ur kindly reply. am do my pocket pc project.wrapping is the same concept for message typing in our

    mobile.when the first page filled ,we can see second page for page down button click event.......... i know the concept

    but i know how can use in coding.................................

     if u know any idea ...............

    Thursday, September 27, 2007 8:05 AM
  • Still not clear what you want, sorry.

    Thursday, September 27, 2007 5:38 PM
  • For Each ch In strMessage

    ch = GetChar(strMessage, ipos)

    Wid = g.MeasureString(ch, Font)

    icharwid = Wid.Width

    If strwhtspace Then

      If icharwid < ilblwid Then

         arr = strwhtspace

         lblMsg.Text = arr

     End If

    Else

    End If

    ipos += 1

    Next

     

     

    HI,

                 This is one part of my coding......using for each loop i compare string widh and label width,and compare it,if

    string width is < label width,then get that string in label first line ..........else goto second line for the label...........

    This is my task..... i can find out whitespace between strings,             But i dont know how to store it one arry and retrieve label box.............................. hey buddy if u know ....... help....... expect u

    Saturday, September 29, 2007 5:25 AM
  • I’m still not sure what this code suppose to do (besides consuming huge amount of CPU power).  Are you trying to wrap text in a label on a white space? There’s no need to as label control does that automatically.

    Sunday, September 30, 2007 5:33 PM
  • I think he's trying to calculate the height of the label that wraps the long text. Take a look at this old post of mine for some ideas:

     

    http://blog.opennetcf.org/ayakhnin/PermaLink,guid,d652ddf7-8702-4253-a431-357703dc63c1.aspx

     

    Sunday, September 30, 2007 6:16 PM
  • hi buddy,

     

                thanks many......... your site was very use full for my concept, if any other site address u have , please send it..........................

       

    Wednesday, October 3, 2007 9:12 AM
  • Hi,

                http://blog.opennetcf.org/ayakhnin/PermaLink,guid,d652ddf7-8702-4253-a431-357703dc63c1.aspx 

     

     

                                         Thanks for given this site address,i think you wrapped your string in tool tip box,

    can u possible to send, how can i utilize this concept in label box...........................

    i expect uuuuuuuuuuuuuuuuuuuu more

     

                 

    Monday, October 8, 2007 4:56 AM
  • Hi buddy ,

     

    http://blog.opennetcf.org/ayakhnin/PermaLink,guid,d652ddf7-8702-4253-a431-357703dc63c1.aspx

     

     

                         This example give information about how did wraping in tooltip control. but i dont know how can

    i use this concept in label box............

     

     

    And one more thing.............

     

    Dim message1 As String = ".net compact framework is used to develop mobiles applications like smart phones and pocket pcs"

     

    Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click

    Dim ilblWidth As Integer

    Dim msgWidth1 As Integer

    Dim msgWidth2 As Integer

    Dim iline1Wid1 As Integer

    Dim iline1Wid2 As Integer

    ' Dim ch As Char

    Dim strMid1 As String

    Dim strMid2 As String

    Dim alines(10) As String

    Dim ipos1 As Integer = 1

    Dim ipos2 As Integer

    Dim message2 As String

    ilblWidth = lbl.Width

    wid0 = g.MeasureString(message1, Font)

    msgWidth1 = wid0.Width

    If msgWidth1 > ilblWidth Then

    ' ch = GetChar(message, ipos)

    For ipos1 = 1 To message1.Length - 1

    If Char.IsWhiteSpace(message1, ipos1) = True Then

    strMid1 = Mid(message1, 7, ipos1)

    wid1 = g.MeasureString(strMid1, Font)

    iline1Wid1 = wid1.Width

    If ilblWidth > iline1Wid1 Then

    alines(0) = strMid1

    ipos2 = Len(strMid1)

    'lbl.Text = alines(0)

    End If

    End If

    'ipos1 += 1

    Next

     

     

     

     

    It gives the result in my label box like this="".net compact framework "..........I expect this

     

     

                    But when i change the starting postion 7 the answer araised

     

    "compact framework is us"...........like this

    "compact framework is    "........................I need This much result........... because i compare iswhitespace properety ..............

     

                       Please help buddy................

     

    Monday, October 8, 2007 5:55 AM
  •  

    hi guys,

     

    This is my coding i try to do wrap my text in label control, but have "Index out of range "  error ............... Please help me its urgent

     

     

     

     

     

     

     

     

     

     

    Public Class Form1

     

        Dim message As String = "dot net is good for all kind of pocket pcs and smart phones"

     

        Dim intMsglen As Integer = message.Length

     

        Dim strmid As String

        'dim     intpos  as Integer = 0

     

        Public Sub wrap()

     

            Dim wid0 As SizeF = New SizeF

     

            Dim wid1 As SizeF = New SizeF

     

            Dim g As Graphics = Me.CreateGraphics

     

     

            Dim intMessagewid As Integer

     

            Dim intLinewid As Integer

     

            Dim intIndex As Integer = 0

     

            Dim intMidstrpos As Integer = 1

     

            Dim intaLines As Integer

     

            Dim aLines(intIndex) As String

            wid0 = g.MeasureString(message, Font)

     

            intMessagewid = wid0.Width

     

     

            If lbl.Width < intMessagewid Then

     

                For intpos As Integer = 1 To message.Length Step 1

     

                    If Char.IsWhiteSpace(message, intpos - 1) Then

                        strmid = Mid(message, intMidstrpos, intpos - 1)

                        wid1 = g.MeasureString(strmid, Font)

                        intLinewid = wid1.Width

                    End If

                    If intLinewid < lbl.Width Then

                        aLines(0) = strmid

                        If strmid <> "" Then

                            intaLines = aLines(0).Length

                            'lbl.Text = aLines(intIndex)

                        End If

                    End If

     

                    If lbl.Width < intLinewid Then

                        message = Mid(message, intaLines + 1, intMsglen - intaLines)

                        intIndex += 1

                        intpos = 0

                    End If

                Next

            End If

        End Sub

     

        Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click

            wrap()

        End Sub

    End Class

     

     

     

     

     

     

     

     

     

     

    Tuesday, October 9, 2007 12:16 PM
  • hi buddy ,

     

                I got result for my programing using wrapping concept, Thank u for your guidence........ take care keep in contact.I given my codings also.......

     

             bb.ganesh@gmail.com   is my mail id.....................

     

     

     

    "MY WRAP CODE"

     

    Imports System.Windows.Forms

    Public Class frmWrap

    Dim wid As SizeF = New SizeF 'To create object for SizeF for whole string

    Dim wid1 As SizeF = New SizeF 'Create another object for specific lines

    Dim g As Graphics = Me.CreateGraphics 'Create object for graphics

    Dim intpos As Integer 'intpos as integer for position

    Dim intaLinelen As Integer

    Dim intIndex As Integer = 16

    Dim intMidstrscroll As Integer

    Dim intStrconcat As Integer

    Dim intTemp As Integer

    Dim strMid As String

    Dim strMidscroll As String

    Dim aLines(intIndex) As String

    Dim strConcat As String

    'The following Variables used for Scrolling concept

    Dim intStrpos As Integer = 0

    Dim intNooflines As Integer = 3

     

     

     

    Public Sub wrap()

    Dim message As String = "Dot net comp frame work is used to develop mobile applications like smart phones and pocket pcs,now comparing smart phones pocket pc's have more feature ,one important merits for pocket pc in touch screen,and size normally smart phone pixel rate is hundred' but pocket pc have twice of the smart phone size thats all me * "

    Dim intmessagelen As Integer = message.Length

    Dim intLblwidth As Integer

    Dim intLblheight As Integer

    Dim intmessagewidth As Integer

    Dim intMidstrpos As Integer

    Dim intLinewidth As Integer

     

    Dim ch As Char

    intLblwidth = lbl.Width

    wid = g.MeasureString(message, Font)

    intmessagewidth = wid.Width

    intLblheight = lbl.Height

    If intLblwidth < intmessagewidth Then

    intIndex = 0

    For intpos = 1 To message.Length Step 1

    If intIndex = 0 Then

    intMidstrpos = 1

    Else

    intMidstrpos = 2

    End If

    If Char.IsWhiteSpace(message, intpos - 1) = True Then

    strMid = Mid(message, intMidstrpos, intpos - 1)

    wid1 = g.MeasureString(strMid, Font)

    intLinewidth = wid1.Width

    End If

    If intLinewidth < intLblwidth Then

    aLines(intIndex) = strMid

    If aLines(intIndex) <> "" Then

    intaLinelen = aLines(intIndex).Length

    End If

    End If

    If intLinewidth > intLblwidth Then

    message = Mid(message, intaLinelen + 1, intmessagelen - intaLinelen)

    intpos = 0

    intIndex += 1

    End If

    ch = GetChar(message, intpos + 1)

    If ch = "*" Then

    Exit For

    End If

    'lbl.Text = ""

    'For intConcat As Integer = 0 To intIndex - 1

    ' strConcat = aLines(intConcat)

    ' lbl.Text = lbl.Text & strConcat

    'Next

    Next

    End If

    End Sub

    Private Sub frmWrap_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    wrap()

    End Sub

    Public Sub scroll()

    lbl.Text = ""

    Dim intTemp As Integer

    intTemp = intStrpos

    For intScroll As Integer = 0 To intNooflines

    lbl.Text = lbl.Text & aLines(intTemp)

    intTemp += 1

    Next

    End Sub

     

    Private Sub frmWrap_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

    If (e.KeyCode = System.Windows.Forms.Keys.Down) Then

    If intStrpos < intIndex Then

    scroll()

    intStrpos += 4

    End If

    End If

    If (e.KeyCode = System.Windows.Forms.Keys.Up) Then

    If intStrpos > 3 Then

    intStrpos -= 4

    scroll()

    ElseIf intStrpos >= 8 And intStrpos <= intIndex Then

    intStrpos -= 8

    scroll()

    End If

    End If

     

    End Sub

    End Class

     

     

     

     

     

     

    Saturday, October 13, 2007 8:07 AM
  • Hi buddy ,

     

                   i got resut for  wraping concept .........thank  u for ur guidence........

     

     

    "This is my code"

     

    Imports System.Windows.Forms

    Public Class frmWrap

    Dim wid As SizeF = New SizeF 'To create object for SizeF for whole string

    Dim wid1 As SizeF = New SizeF 'Create another object for specific lines

    Dim g As Graphics = Me.CreateGraphics 'Create object for graphics

    Dim intpos As Integer 'intpos as integer for position

    Dim intaLinelen As Integer

    Dim intIndex As Integer = 16

    Dim intMidstrscroll As Integer

    Dim intStrconcat As Integer

    Dim intTemp As Integer

    Dim strMid As String

    Dim strMidscroll As String

    Dim aLines(intIndex) As String

    Dim strConcat As String

    'The following Variables used for Scrolling concept

    Dim intStrpos As Integer = 0

    Dim intNooflines As Integer = 3

     

     

     

    Public Sub wrap()

    Dim message As String = "Dot net comp frame work is used to develop mobile applications like smart phones and pocket pcs,now comparing smart phones pocket pc's have more feature ,one important merits for pocket pc in touch screen,and size normally smart phone pixel rate is hundred' but pocket pc have twice of the smart phone size thats all me * "

    Dim intmessagelen As Integer = message.Length

    Dim intLblwidth As Integer

    Dim intLblheight As Integer

    Dim intmessagewidth As Integer

    Dim intMidstrpos As Integer

    Dim intLinewidth As Integer

     

    Dim ch As Char

    intLblwidth = lbl.Width

    wid = g.MeasureString(message, Font)

    intmessagewidth = wid.Width

    intLblheight = lbl.Height

    If intLblwidth < intmessagewidth Then

    intIndex = 0

    For intpos = 1 To message.Length Step 1

    If intIndex = 0 Then

    intMidstrpos = 1

    Else

    intMidstrpos = 2

    End If

    If Char.IsWhiteSpace(message, intpos - 1) = True Then

    strMid = Mid(message, intMidstrpos, intpos - 1)

    wid1 = g.MeasureString(strMid, Font)

    intLinewidth = wid1.Width

    End If

    If intLinewidth < intLblwidth Then

    aLines(intIndex) = strMid

    If aLines(intIndex) <> "" Then

    intaLinelen = aLines(intIndex).Length

    End If

    End If

    If intLinewidth > intLblwidth Then

    message = Mid(message, intaLinelen + 1, intmessagelen - intaLinelen)

    intpos = 0

    intIndex += 1

    End If

    ch = GetChar(message, intpos + 1)

    If ch = "*" Then

    Exit For

    End If

    'lbl.Text = ""

    'For intConcat As Integer = 0 To intIndex - 1

    ' strConcat = aLines(intConcat)

    ' lbl.Text = lbl.Text & strConcat

    'Next

    Next

    End If

    End Sub

    Private Sub frmWrap_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    wrap()

    End Sub

    Public Sub scroll()

    lbl.Text = ""

    Dim intTemp As Integer

    intTemp = intStrpos

    For intScroll As Integer = 0 To intNooflines

    lbl.Text = lbl.Text & aLines(intTemp)

    intTemp += 1

    Next

    End Sub

     

    Private Sub frmWrap_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

    If (e.KeyCode = System.Windows.Forms.Keys.Down) Then

    If intStrpos < intIndex Then

    intStrpos += 4

    scroll()

    intStrpos += 4

    End If

    End If

    If (e.KeyCode = System.Windows.Forms.Keys.Up) Then

    If intStrpos > 3 Then

    intStrpos -= 4

    scroll()

    ElseIf intStrpos >= 8 And intStrpos <= intIndex Then

    intStrpos -= 8

    scroll()

    End If

    End If

     

    End Sub

    End Class

     

     

     

     

     

     

    Saturday, October 13, 2007 8:11 AM