Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Moving Character Glyphs

Moving Character Glyphs

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Quecumber256
    wrote on last edited by
    #1

    Hello Everyone: I have an interesting problem. I modified a C# application written by Bob Powell that demonstrated how to move graphic primitives to Visual Basic 2005 .NET. I want to take this a step further and be able to move alphanumeric characters around on the screen using the mouse. My problem is I can draw a series of characters using the DrawPath method, but when I point to a specific character to hit test it the application’s HitTest Function does not recognize the character. I’m guessing the problem lies in the class I created for the text, but I don’t know how to solve the problem. I wrote to Bob Powell and he suggested using glyphs. I’m assuming he wanted me to take the fonts and convert them to glyphs. This is where I get confused; a font is just a glyph. It seems redundant to create a glyph out of a glyph. A single font character has a height and a width. The hit test function returns those values and uses them to create a rectangle around the graphic primitive I’m pointing too. Once the primitive is highlighted I can move it elsewhere on the screen by holding down the left mouse button and move the mouse to another position on the screen dragging the highlighted primitive with it. Does anyone have any ideas? Quecumber256

    D 1 Reply Last reply
    0
    • Q Quecumber256

      Hello Everyone: I have an interesting problem. I modified a C# application written by Bob Powell that demonstrated how to move graphic primitives to Visual Basic 2005 .NET. I want to take this a step further and be able to move alphanumeric characters around on the screen using the mouse. My problem is I can draw a series of characters using the DrawPath method, but when I point to a specific character to hit test it the application’s HitTest Function does not recognize the character. I’m guessing the problem lies in the class I created for the text, but I don’t know how to solve the problem. I wrote to Bob Powell and he suggested using glyphs. I’m assuming he wanted me to take the fonts and convert them to glyphs. This is where I get confused; a font is just a glyph. It seems redundant to create a glyph out of a glyph. A single font character has a height and a width. The hit test function returns those values and uses them to create a rectangle around the graphic primitive I’m pointing too. Once the primitive is highlighted I can move it elsewhere on the screen by holding down the left mouse button and move the mouse to another position on the screen dragging the highlighted primitive with it. Does anyone have any ideas? Quecumber256

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      I assuming the hit test fails because you can't click exactly on the drawn part of the character and not the white space inside it. You're, basically, trying to click on a very thin line and missing. I hope anyway... I have no idea if this solution would work for you, but you already know how to click and move a graphic image, so draw the text onto a small bitmap and left the user click and drag the bitmap around.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      Q 1 Reply Last reply
      0
      • D Dave Kreskowiak

        I assuming the hit test fails because you can't click exactly on the drawn part of the character and not the white space inside it. You're, basically, trying to click on a very thin line and missing. I hope anyway... I have no idea if this solution would work for you, but you already know how to click and move a graphic image, so draw the text onto a small bitmap and left the user click and drag the bitmap around.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        Q Offline
        Q Offline
        Quecumber256
        wrote on last edited by
        #3

        Hi Dave: Thanks for the input. The experiment I'm running uses a 50 point font, which in turn produces an image large enough to know you are clicking on the character itself. The bitmap approch did occur to me as a possible solution, but considering the work involved producing 255 bitmaps, one for each ANSI character it didn't seem like it would be practical. Obviously there is a fundimental difference between shapes drawn using GDI+ and how GDI+ handles fonts. There has got to be some method out there that will allow me to capture the font, but so far my searches have produced ziltch. Quecumber256

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups