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. Drawing border to items of listview

Drawing border to items of listview

Scheduled Pinned Locked Moved C#
questionc++comgraphics
8 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.
  • A Offline
    A Offline
    anu81
    wrote on last edited by
    #1

    hi all, I am using a listview to display thumbnail of images with some text. i have used largeicon view to display them. i have created the thumbnail images and its displayed. as in explorer, i need to have the thumbnail image displayed as a folder. (like a border to the thumbnail and text). How can i do it? i saw a article here in Codeproject but the code is in VC++.and i am not aware of this. Is there any way to accomplish the same?

    Thanks in advance.:) Regards Anuradha

    G 1 Reply Last reply
    0
    • A anu81

      hi all, I am using a listview to display thumbnail of images with some text. i have used largeicon view to display them. i have created the thumbnail images and its displayed. as in explorer, i need to have the thumbnail image displayed as a folder. (like a border to the thumbnail and text). How can i do it? i saw a article here in Codeproject but the code is in VC++.and i am not aware of this. Is there any way to accomplish the same?

      Thanks in advance.:) Regards Anuradha

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      Yes there is. First of all you need to set OwnerDraw property of ListView class to true. By doing this you are responsible for providing code for drawing the control. After that handle the ItemDraw event of the listview class to make necessary drawings.

      #region signature my articles #endregion

      A 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        Yes there is. First of all you need to set OwnerDraw property of ListView class to true. By doing this you are responsible for providing code for drawing the control. After that handle the ItemDraw event of the listview class to make necessary drawings.

        #region signature my articles #endregion

        A Offline
        A Offline
        anu81
        wrote on last edited by
        #3

        hi, Thanks for your help. i have started to use the drawitem event of the listview control and i am making improvement in that. Thanks for your suggestions. But could you please provide me with a link where i might be able to draw a perfect rectangle for the items using drawitem event?

        Thanks in advance.:) Regards Anuradha

        G 1 Reply Last reply
        0
        • A anu81

          hi, Thanks for your help. i have started to use the drawitem event of the listview control and i am making improvement in that. Thanks for your suggestions. But could you please provide me with a link where i might be able to draw a perfect rectangle for the items using drawitem event?

          Thanks in advance.:) Regards Anuradha

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          Examine properties of the DrawListViewItemEventArgs parameter that the DrawItem event receives.

          #region signature my articles #endregion

          A 1 Reply Last reply
          0
          • G Giorgi Dalakishvili

            Examine properties of the DrawListViewItemEventArgs parameter that the DrawItem event receives.

            #region signature my articles #endregion

            A Offline
            A Offline
            anu81
            wrote on last edited by
            #5

            hi, Thanks for your suggestions. i have drawn the image and the text using the properties of drawlistitemeventargs(thanks). but still i am not able to figure out how to draw the border for that item. Could you please help me by suggesting some links? Thanks once again. Regards Anuradha

            G 1 Reply Last reply
            0
            • A anu81

              hi, Thanks for your suggestions. i have drawn the image and the text using the properties of drawlistitemeventargs(thanks). but still i am not able to figure out how to draw the border for that item. Could you please help me by suggesting some links? Thanks once again. Regards Anuradha

              G Offline
              G Offline
              Giorgi Dalakishvili
              wrote on last edited by
              #6

              The drawlistitemeventargs parameter called e has a graphics property which you use for drawing. So you need to call e.Graphics.DrawRectangle method to draw rectangle around the item. In order to pass the desired rectangle to this method explore e.Bounds property and e.Item.Bounds property. Hope this helps

              #region signature my articles #endregion

              A 1 Reply Last reply
              0
              • G Giorgi Dalakishvili

                The drawlistitemeventargs parameter called e has a graphics property which you use for drawing. So you need to call e.Graphics.DrawRectangle method to draw rectangle around the item. In order to pass the desired rectangle to this method explore e.Bounds property and e.Item.Bounds property. Hope this helps

                #region signature my articles #endregion

                A Offline
                A Offline
                anu81
                wrote on last edited by
                #7

                hi, Thanks a lot for your help. I am able to draw the border now for each item. Thanks once again. Regards Anuradha

                G 1 Reply Last reply
                0
                • A anu81

                  hi, Thanks a lot for your help. I am able to draw the border now for each item. Thanks once again. Regards Anuradha

                  G Offline
                  G Offline
                  Giorgi Dalakishvili
                  wrote on last edited by
                  #8

                  You are welcome :)

                  #region signature my articles #endregion

                  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