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. Get graphics

Get graphics

Scheduled Pinned Locked Moved Visual Basic
graphicshelpquestion
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
    The real M
    wrote on last edited by
    #1

    Merry Christmas to everyone! Don't you know how I can get the image my form looks like? I've tried DrawToBitmap method, but with that I didn't get the graphics, just the controls. Please help if you can.

    P L 2 Replies Last reply
    0
    • T The real M

      Merry Christmas to everyone! Don't you know how I can get the image my form looks like? I've tried DrawToBitmap method, but with that I didn't get the graphics, just the controls. Please help if you can.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      What is it you are trying to do? Put a picture on the form or as a background for the form?

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer

      T 1 Reply Last reply
      0
      • T The real M

        Merry Christmas to everyone! Don't you know how I can get the image my form looks like? I've tried DrawToBitmap method, but with that I didn't get the graphics, just the controls. Please help if you can.

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

        Hi, if you do the graphics correctly, you will catch it. Here is a tiny paint instruction: there are several steps to draw something so it becomes visible on the screen: 1. decide upon what object you want to draw; it normally is a Control (e.g. a Panel) or a Form itself. I prefer to add a Panel to a Form, then draw on the Panel. 2. create some variables (Rectangle, struct, class, whatever) that hold the parameters of your drawing. For a rectangle that could be top and left coordinate, and width+height, or just a Rectangle. etc. 3. create a Paint handler for that Panel, and do all your drawing in there, using the Graphics class and your variables. 4. when you want to change things, modify the variables and call Panel.Invalidate() or one of its overloads (for selective invalidation). 5. If you want to animate things, perform the move (step 4) inside the Tick handler of a Windows.Forms.Timer BTW: if you need to create some objects (Fonts, Pens, Brushes, ...) either keep them alive in class members (hence create them only once); or create them inside the Paint handler and don't forget to call Dispose() on them. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        Happy Holidays!


        1 Reply Last reply
        0
        • P Paul Conrad

          What is it you are trying to do? Put a picture on the form or as a background for the form?

          "The clue train passed his station without stopping." - John Simmons / outlaw programmer

          T Offline
          T Offline
          The real M
          wrote on last edited by
          #4

          Sorry I didn't write clearly, my problem is the following: I've a form, and controls in it. I want to get the same image that the user sees on the screen. If I don't use graphics, I can use DrawToBitmap method. But what should I do if I use graphics too??? :doh:

          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