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. C#
  4. Image Annotation in C#

Image Annotation in C#

Scheduled Pinned Locked Moved C#
questioncsharphelptutorial
6 Posts 4 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.
  • S Offline
    S Offline
    snouto
    wrote on last edited by
    #1

    Hello everyone , i am designing an image annotation tool . In any image annotation tool , it enables you to drag a rectangle which for example shows an image , text or any other stuff inside of it , then when you click and drag the rectangle resizes itself accordingly over the shown image . The question is : which is the best programming practice for this task ???? , is it either to create a rectangle and keep track of the x,y coordinates and change the size of the rectangle accordingly ???? or to inherit from the CONTROL Class and implement its methods like onMouseDown , OnMouseMove ....etc ???? Second thing ..... : i need to know how can i place handles surrounding the rectangle ? and enable the user to change its Size according to its movement either to the right , left , top or bottom .????? any help or existing examples to see ... Any help will be greatly appreciated.... Thank you

    Human knowledge belongs to the world.

    P L R 3 Replies Last reply
    0
    • S snouto

      Hello everyone , i am designing an image annotation tool . In any image annotation tool , it enables you to drag a rectangle which for example shows an image , text or any other stuff inside of it , then when you click and drag the rectangle resizes itself accordingly over the shown image . The question is : which is the best programming practice for this task ???? , is it either to create a rectangle and keep track of the x,y coordinates and change the size of the rectangle accordingly ???? or to inherit from the CONTROL Class and implement its methods like onMouseDown , OnMouseMove ....etc ???? Second thing ..... : i need to know how can i place handles surrounding the rectangle ? and enable the user to change its Size according to its movement either to the right , left , top or bottom .????? any help or existing examples to see ... Any help will be greatly appreciated.... Thank you

      Human knowledge belongs to the world.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      I would be tempted to create a rectangle control here. The interaction logic for sizing/moving the rectangle would be contained in this class, then all your image control would need to do would be to hold references to the rectangle. The rectangle drawing could implement a simple handle drawing algorithm which drew a square at the corners. If you want to see some sample code that does this, you can take a look at the Netron library here[^].

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      S 1 Reply Last reply
      0
      • S snouto

        Hello everyone , i am designing an image annotation tool . In any image annotation tool , it enables you to drag a rectangle which for example shows an image , text or any other stuff inside of it , then when you click and drag the rectangle resizes itself accordingly over the shown image . The question is : which is the best programming practice for this task ???? , is it either to create a rectangle and keep track of the x,y coordinates and change the size of the rectangle accordingly ???? or to inherit from the CONTROL Class and implement its methods like onMouseDown , OnMouseMove ....etc ???? Second thing ..... : i need to know how can i place handles surrounding the rectangle ? and enable the user to change its Size according to its movement either to the right , left , top or bottom .????? any help or existing examples to see ... Any help will be greatly appreciated.... Thank you

        Human knowledge belongs to the world.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        When in doubt, I'm inclined to not use Controls and create my own classes of visible, drawable, movable parts. Takes some more code, but leads to snappier behavior as soon as you need lots of them. It also could offer more functionality, e.g. an easier selection of objects (select nearest, select by clicking through hollow shapes, etc). As I understand your requirements (only a few controls involved), it wouldn't matter much, provided you don't get into transparency problems. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read formatted code with indentation, so please use PRE tags for code snippets.


        I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


        1 Reply Last reply
        0
        • P Pete OHanlon

          I would be tempted to create a rectangle control here. The interaction logic for sizing/moving the rectangle would be contained in this class, then all your image control would need to do would be to hold references to the rectangle. The rectangle drawing could implement a simple handle drawing algorithm which drew a square at the corners. If you want to see some sample code that does this, you can take a look at the Netron library here[^].

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          S Offline
          S Offline
          snouto
          wrote on last edited by
          #4

          Netron Library couldn't be downloaded .. if you have it , please send me a working download link . so for good programming practice, you recommend me to create a rectangle object not to inherit from the control class and do the work inside ???? did i understand you correctly ?

          Human knowledge belongs to the world.

          P 1 Reply Last reply
          0
          • S snouto

            Hello everyone , i am designing an image annotation tool . In any image annotation tool , it enables you to drag a rectangle which for example shows an image , text or any other stuff inside of it , then when you click and drag the rectangle resizes itself accordingly over the shown image . The question is : which is the best programming practice for this task ???? , is it either to create a rectangle and keep track of the x,y coordinates and change the size of the rectangle accordingly ???? or to inherit from the CONTROL Class and implement its methods like onMouseDown , OnMouseMove ....etc ???? Second thing ..... : i need to know how can i place handles surrounding the rectangle ? and enable the user to change its Size according to its movement either to the right , left , top or bottom .????? any help or existing examples to see ... Any help will be greatly appreciated.... Thank you

            Human knowledge belongs to the world.

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            I believe you're looking for a C# version of a CRectTracker[^].  See this[^] article. /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            1 Reply Last reply
            0
            • S snouto

              Netron Library couldn't be downloaded .. if you have it , please send me a working download link . so for good programming practice, you recommend me to create a rectangle object not to inherit from the control class and do the work inside ???? did i understand you correctly ?

              Human knowledge belongs to the world.

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              You did. If the link isn't working there, there's a version on Sourceforge[^].

              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

              My blog | My articles | MoXAML PowerToys | Onyx

              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