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. DRawable Panel, Resize and Scrollbars !

DRawable Panel, Resize and Scrollbars !

Scheduled Pinned Locked Moved C#
winformsgraphicshelpquestion
2 Posts 1 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.
  • F Offline
    F Offline
    Frank Olorin Rizzi
    wrote on last edited by
    #1

    This is starting to get to me ! So, let me ask you all, just in case someone has a quick solution for my problem. Here's what I would like to do. Imageine a simple Win App, with a main form with a couple of buttons, and a panel. The buttons are "Rectangle", "Ellipses", and "None". If you click on the "Rectangle" button, you can draw a rectangle in the panel (by clicking-dragging in the panel). Similarly, if you click on the "Ellipses" button, you'll be able to draw an ellipses in the panel. The "None" button is there simply to let you go back to your standard mouse situation. So far so good. I got all of that working by using the GDI+ DrawRectangle and DrawEllipses functions. Now, my problem is that I can't make the panel pop-up the scrollbars (both vertical and horizontal) as needed. In other words, if I open up the application, maximize it to full screen, and draw something in the lower-right corner of the panel, when I resize the application to a smaller size, the drawn object does not show up in the panel (duh! it's out there somewhere). But, most importantly, the scrollbars of the panel do not appear either ! I've tried to set to true the AutoScroll property of the panel, and set the minimum size and the actual size of the scrollbars to (5,5), but that had no impact. As far as I can tell, the problem is that the AutoScroll property comes into play only if some "Control" is placed outside the viewable area of the panel at some point, while the rectangles and circles are (being drawn with GDI+) not considered controls ! Any suggestions ? Thanks in advance for your 2 pennies :-) F.O.R.

    F 1 Reply Last reply
    0
    • F Frank Olorin Rizzi

      This is starting to get to me ! So, let me ask you all, just in case someone has a quick solution for my problem. Here's what I would like to do. Imageine a simple Win App, with a main form with a couple of buttons, and a panel. The buttons are "Rectangle", "Ellipses", and "None". If you click on the "Rectangle" button, you can draw a rectangle in the panel (by clicking-dragging in the panel). Similarly, if you click on the "Ellipses" button, you'll be able to draw an ellipses in the panel. The "None" button is there simply to let you go back to your standard mouse situation. So far so good. I got all of that working by using the GDI+ DrawRectangle and DrawEllipses functions. Now, my problem is that I can't make the panel pop-up the scrollbars (both vertical and horizontal) as needed. In other words, if I open up the application, maximize it to full screen, and draw something in the lower-right corner of the panel, when I resize the application to a smaller size, the drawn object does not show up in the panel (duh! it's out there somewhere). But, most importantly, the scrollbars of the panel do not appear either ! I've tried to set to true the AutoScroll property of the panel, and set the minimum size and the actual size of the scrollbars to (5,5), but that had no impact. As far as I can tell, the problem is that the AutoScroll property comes into play only if some "Control" is placed outside the viewable area of the panel at some point, while the rectangles and circles are (being drawn with GDI+) not considered controls ! Any suggestions ? Thanks in advance for your 2 pennies :-) F.O.R.

      F Offline
      F Offline
      Frank Olorin Rizzi
      wrote on last edited by
      #2

      Got it ! Just for future reference of anyone who stumbles upon this: look at the following two articles here on CodeProject: http://www.codeproject.net/books/1861004990.asp and http://www.codeproject.com/cs/miscctrl/tracker.asp As a summary, I think my main mistake was to set the AutoScrollMinSIze to a value that was too small (5,5). Once I set this to the value of the highest X (and Y) coordinate of the stuff I was drawing, it worked much better! HTH, F.O.R. PS: funny thing is I *do* have the WROX book from the first link, but I left it at the office !

      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