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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. graphics

graphics

Scheduled Pinned Locked Moved Visual Basic
graphicshelptutorialquestion
4 Posts 3 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.
  • T Offline
    T Offline
    TheMrProgrammer
    wrote on last edited by
    #1

    i am developing an app in which i have used graphics object to create and fill a rectangle with some color. now i want to know when the user clicks inside the rectangle but i am getting some problems currently i am doing this with if-elseif conditions wouldn't a much better way to do this is by associating the click event to the rectangle i can't figure out how to associate events with the rectangle is it possible? if yes then please help else tell if there any other way of doing it other than using a label or a picture box end if thanx

    TheMrProgrammer

    L 1 Reply Last reply
    0
    • T TheMrProgrammer

      i am developing an app in which i have used graphics object to create and fill a rectangle with some color. now i want to know when the user clicks inside the rectangle but i am getting some problems currently i am doing this with if-elseif conditions wouldn't a much better way to do this is by associating the click event to the rectangle i can't figure out how to associate events with the rectangle is it possible? if yes then please help else tell if there any other way of doing it other than using a label or a picture box end if thanx

      TheMrProgrammer

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

      Hi, The only UI objects that support events are Controls. Most of them are rectangular, so you are in luck. You could use say a Panel and set its background color. OTOH a Rectangle has a Contains() method which takes a Point, and a MouseEventArg gives you a Point, so you don't have to switch to Controls (which wouldn't make things easy when non-rectangular anyway). :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      T 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, The only UI objects that support events are Controls. Most of them are rectangular, so you are in luck. You could use say a Panel and set its background color. OTOH a Rectangle has a Contains() method which takes a Point, and a MouseEventArg gives you a Point, so you don't have to switch to Controls (which wouldn't make things easy when non-rectangular anyway). :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        T Offline
        T Offline
        TheMrProgrammer
        wrote on last edited by
        #3

        thanks but whats OTOH

        TheMrProgrammer

        H 1 Reply Last reply
        0
        • T TheMrProgrammer

          thanks but whats OTOH

          TheMrProgrammer

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          Google for unknown acronyms. OTOH means 'On The Other Hand'

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          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