ev.graphics

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • max

    ev.graphics

    Is there a method in the Graphic to wrap a string into a rectangle?
    If so is there a way to specify the width and let a Graphics method
    determine how much vertical space is required? I tried using
    ..MeasureString but get weird numbers for the width and height.
    ({System.Drawin g.SizeF}
    Empty: {System.Drawing .SizeF}
    Height: 21.248373
    IsEmpty: False
    Width: 40.8447266)

    The SizeF I used for the layout rect was
    Dim layoutSize As New SizeF(500.0F, 0.0F)

    Thanks,
    --max
  • Armin Zingler

    #2
    Re: ev.graphics

    <max> schrieb im Newsbeitrag
    news:37u4g1ljjb r82ekm6vb0m937k 5rnfumumg@4ax.c om...[color=blue]
    > Is there a method in the Graphic to wrap a string into a rectangle?[/color]

    Have you had a look at all the overloaded DrawString methods? One does what
    you need.
    [color=blue]
    > If so is there a way to specify the width and let a Graphics method
    > determine how much vertical space is required? I tried using
    > .MeasureString but get weird numbers for the width and height.
    > ({System.Drawin g.SizeF}
    > Empty: {System.Drawing .SizeF}
    > Height: 21.248373
    > IsEmpty: False
    > Width: 40.8447266)
    >
    > The SizeF I used for the layout rect was
    > Dim layoutSize As New SizeF(500.0F, 0.0F)[/color]


    Why are these values weired? We don't know the string you measured.

    BTW, there's a specialized group for these questions:
    microsoft.publi c.dotnet.framew ork.drawing


    Armin




    Comment

    • max

      #3
      Re: ev.graphics

      Thanks for the lead to the correct group.

      -max

      On Wed, 17 Aug 2005 10:12:53 +0200, "Armin Zingler"
      <az.nospam@free net.de> wrote:
      [color=blue]
      ><max> schrieb im Newsbeitrag
      >news:37u4g1ljj br82ekm6vb0m937 k5rnfumumg@4ax. com...[color=green]
      >> Is there a method in the Graphic to wrap a string into a rectangle?[/color]
      >
      >Have you had a look at all the overloaded DrawString methods? One does what
      >you need.
      >[color=green]
      >> If so is there a way to specify the width and let a Graphics method
      >> determine how much vertical space is required? I tried using
      >> .MeasureString but get weird numbers for the width and height.
      >> ({System.Drawin g.SizeF}
      >> Empty: {System.Drawing .SizeF}
      >> Height: 21.248373
      >> IsEmpty: False
      >> Width: 40.8447266)
      >>
      >> The SizeF I used for the layout rect was
      >> Dim layoutSize As New SizeF(500.0F, 0.0F)[/color]
      >
      >
      >Why are these values weired? We don't know the string you measured.
      >
      >BTW, there's a specialized group for these questions:
      >microsoft.publ ic.dotnet.frame work.drawing
      >
      >
      >Armin
      >
      >
      >[/color]

      Comment

      • Dennis

        #4
        Re: ev.graphics

        Try

        Dim sz As SizeF = gph.MeasureStri ng(myString, MyFont, Width, MyStringFormat)

        'sz will be returned with the height needed based on the string, width, and
        alignment you want.

        --
        Dennis in Houston


        "max" wrote:
        [color=blue]
        > Thanks for the lead to the correct group.
        >
        > -max
        >
        > On Wed, 17 Aug 2005 10:12:53 +0200, "Armin Zingler"
        > <az.nospam@free net.de> wrote:
        >[color=green]
        > ><max> schrieb im Newsbeitrag
        > >news:37u4g1ljj br82ekm6vb0m937 k5rnfumumg@4ax. com...[color=darkred]
        > >> Is there a method in the Graphic to wrap a string into a rectangle?[/color]
        > >
        > >Have you had a look at all the overloaded DrawString methods? One does what
        > >you need.
        > >[color=darkred]
        > >> If so is there a way to specify the width and let a Graphics method
        > >> determine how much vertical space is required? I tried using
        > >> .MeasureString but get weird numbers for the width and height.
        > >> ({System.Drawin g.SizeF}
        > >> Empty: {System.Drawing .SizeF}
        > >> Height: 21.248373
        > >> IsEmpty: False
        > >> Width: 40.8447266)
        > >>
        > >> The SizeF I used for the layout rect was
        > >> Dim layoutSize As New SizeF(500.0F, 0.0F)[/color]
        > >
        > >
        > >Why are these values weired? We don't know the string you measured.
        > >
        > >BTW, there's a specialized group for these questions:
        > >microsoft.publ ic.dotnet.frame work.drawing
        > >
        > >
        > >Armin
        > >
        > >
        > >[/color]
        >
        >[/color]

        Comment

        Working...