Labels with graphics?

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

    Labels with graphics?

    Is there a common way to embed a graphic or icon into a label? I want
    to have something like "Press <<IMGBTN1>To Continue" or "Press
    <<IMGBTN2>For Help".

    Normally I'd just create a graphic for the whole string, but this will
    be translated in multiple languages and I want to keep the images
    generic and only translate text.
  • Paul E Collins

    #2
    Re: Labels with graphics?

    "raiderdav" <raiderdav@gmai l.comwrote:
    Is there a common way to embed a graphic or icon into a label?
    Normally I'd just create a graphic for the whole string, but this will
    be translated in multiple languages and I want to keep the images
    generic and only translate text.
    You definitely can't do it with a simple label. You could do it with
    custom drawing in a Paint event, but you'd have to consider things like
    word wrap.

    You could also ensure the image falls outside the label, e.g. "To
    continue, click: <separate image here>". I suppose every language has a
    way of stating this sentence so that the image comes last, but you never
    know.

    The general recommendation is to keep images totally separate from text
    for localisation purposes.

    Eq.


    Comment

    • Ignacio Machin ( .NET/ C# MVP )

      #3
      Re: Labels with graphics?

      On May 12, 10:56 am, raiderdav <raider...@gmai l.comwrote:
      Is there a common way to embed a graphic or icon into a label?  I want
      to have something like "Press <<IMGBTN1>To Continue" or "Press
      <<IMGBTN2>For Help".
      >
      Normally I'd just create a graphic for the whole string, but this will
      be translated in multiple languages and I want to keep the images
      generic and only translate text.
      Hi,

      There is no such a control in the framework, imagine, what if instead
      of one you want two images?, or how to indicate the position of the
      images?
      But it's not difficult to implement, you could create a control that
      is compose of two labels and one PictureBox

      Comment

      • raiderdav

        #4
        Re: Labels with graphics?

        There is no such a control in the framework, imagine, what if instead
        of one you want two images?, or how to indicate the position of the
        images?
        But it's not difficult to implement, you could create a control that
        is compose of two labels and one PictureBox
        Thank you both for the comments. It looks like I'll need to create a
        Label-Image-Label control for myself.

        The icons/images that I need to display are all very simple. I'm also
        considering creating a custom font character for each icon, but I
        suppose that will be difficult to color properly as fonts are all
        single colored, and there is no way to color individual characters
        within a single label (or is there?).

        Thanks,
        dave

        Comment

        • clintonG

          #5
          Re: Labels with graphics?

          Build it using CSS lame-o ;-) but I'm curious why you wouldn't just use an
          ImageButton control?


          "raiderdav" <raiderdav@gmai l.comwrote in message
          news:d8c41e8e-abaa-4223-a788-775ff56a474e@p2 5g2000pri.googl egroups.com...
          Is there a common way to embed a graphic or icon into a label? I want
          to have something like "Press <<IMGBTN1>To Continue" or "Press
          <<IMGBTN2>For Help".
          >
          Normally I'd just create a graphic for the whole string, but this will
          be translated in multiple languages and I want to keep the images
          generic and only translate text.

          Comment

          • raiderdav

            #6
            Re: Labels with graphics?

            On May 12, 10:44 am, "clintonG" <nob...@nowhere .comwrote:
            Build it using CSS lame-o ;-) but I'm curious why you wouldn't just use an
            ImageButton control?
            >
            Haha - thanks for the tip. Actually, some HTML style tags would be
            handy for this.

            If I make it an image button, then when it is translated to different
            languages I need to have a different image for spanish, french,
            german, etc, and call the appropriate image based on the language in
            use. This is for a handheld device (Compact Framework) so I need to
            minimize the number of images and file sizes.

            Comment

            • Ignacio Machin ( .NET/ C# MVP )

              #7
              Re: Labels with graphics?

              On May 12, 11:44 am, "clintonG" <nob...@nowhere .comwrote:
              Build it using CSS lame-o ;-) but I'm curious why you wouldn't just use an
              ImageButton control?
              Hi,

              Good point, OP: is this a web or a win problem?

              Comment

              • raiderdav

                #8
                Re: Labels with graphics?

                Good point, OP: is this a web or a win problem?

                It's a win problem - WinCE to be exact. Not a web app.

                Comment

                • clintonG

                  #9
                  Re: Labels with graphics?

                  I see your point --but-- do you know how to use Expression Builders [1] in
                  ASP.NET? I use the <%= method( ) %all the time with others to dynamically
                  bind properties to my client-side HTML at runtime and do it all the time.
                  Check out these examples [2-4] Its like the Response.Write of ASP.NET and
                  Expression will work for you. Expression Builders will solve your problem
                  localizing.

                  I'm just getting into WPF. It supports several new ways to bind properties
                  to attributes and more dynamic ways to generate the context of the "page" at
                  runtime.

                  [1] http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx

                  [2] ToolTip='<%# "RSS Channel Builder "
                  + Eval("Title")
                  + " Element Is Selected"%>'
                  runat="server" />

                  [3] ToolTip='<%# (Eval("Title") == "Finish Channel")
                  ? "Finish using the RSS Channel Builder"
                  : "RSS Channel "
                  + Eval("Title")
                  + " Element" %>'

                  [4] Text='<%# DataBinder.Eval (Container, "DataItem.Name" )%>'





                  "raiderdav" <raiderdav@gmai l.comwrote in message
                  news:d545b543-1f6c-473f-a5f7-095b0a2b0762@q2 7g2000prf.googl egroups.com...
                  On May 12, 10:44 am, "clintonG" <nob...@nowhere .comwrote:
                  >Build it using CSS lame-o ;-) but I'm curious why you wouldn't just use
                  >an
                  >ImageButton control?
                  >>
                  >
                  Haha - thanks for the tip. Actually, some HTML style tags would be
                  handy for this.
                  >
                  If I make it an image button, then when it is translated to different
                  languages I need to have a different image for spanish, french,
                  german, etc, and call the appropriate image based on the language in
                  use. This is for a handheld device (Compact Framework) so I need to
                  minimize the number of images and file sizes.

                  Comment

                  • clintonG

                    #10
                    Re: Labels with graphics?

                    I have zero experience with Windows applications and replied with comments
                    regarding Expression Builders. Surely there must be a similar construct in
                    Windows Forms as we Web Forms guys can't be having all the fun can we?


                    "raiderdav" <raiderdav@gmai l.comwrote in message
                    news:5d96dd1a-dcfb-4cc7-8e55-62b68a661002@1g 2000prg.googleg roups.com...
                    >Good point, OP: is this a web or a win problem?
                    >
                    It's a win problem - WinCE to be exact. Not a web app.

                    Comment

                    • Ignacio Machin ( .NET/ C# MVP )

                      #11
                      Re: Labels with graphics?

                      On May 12, 2:17 pm, raiderdav <raider...@gmai l.comwrote:
                      On May 12, 10:44 am, "clintonG" <nob...@nowhere .comwrote:
                      >
                      Build it using CSS lame-o ;-) but I'm curious why you wouldn't just use an
                      ImageButton control?
                      >
                      Haha - thanks for the tip.  Actually, some HTML style tags would be
                      handy for this.
                      >
                      If I make it an image button, then when it is translated to different
                      languages I need to have a different image for spanish, french,
                      german, etc, and call the appropriate image based on the language in
                      use.  This is for a handheld device (Compact Framework) so I need to
                      minimize the number of images and file sizes.
                      Hi,

                      In that case consider do not use an image in the first place, unless
                      it really is needed in your app. In any case you will need to create
                      it yourself. Nothing complex though, just two labels and a PictureBox

                      Comment

                      • Ignacio Machin ( .NET/ C# MVP )

                        #12
                        Re: Labels with graphics?

                        On May 12, 12:41 pm, raiderdav <raider...@gmai l.comwrote:
                        There is no such a control in the framework, imagine, what if instead
                        of one you want two images?, or how to indicate the position of the
                        images?
                        But it's not difficult to implement, you could create a control that
                        is compose of two labels and one PictureBox
                        >
                        Thank you both for the comments.  It looks like I'll need to create a
                        Label-Image-Label control for myself.
                        >
                        The icons/images that I need to display are all very simple.  I'm also
                        considering creating a custom font character for each icon, but I
                        suppose that will be difficult to color properly as fonts are all
                        single colored, and there is no way to color individual characters
                        within a single label (or is there?).
                        >
                        Thanks,
                        dave
                        Too complex, just use a Label/PictureBox/Label and move on.

                        Comment

                        Working...