Aligning Rectangles with Controls on the screen

Happy New Year. Hope everyone enjoyed the holidays !
I installed an application I developed in Visual Studio C# on some new laptops with wider higher resolution screens and sent them into the field. Everything works fine with the following exception. A key component to this application is the entry of time
spent on customer sites. It is entered in 15 minute increments.  To aid the employee in entering the time I use radio controls and display the implied time in a graphic bar below the controls.
When the same data is entered on one of the new laptops the rectangles no longer align with the correct radio controls. For example:
The time is split into 24 hours in 15 minute increments. So the following loop works. The color of the rectangle is controlled by an entry in an array  initialized earlier in the code.  The Radio controls are located 20 units apart according the
x,y coordinates in the radio control location property. So I make the width of the rectangle = 5 (20/4 fifteen minute segments) and calculate the left position. 
So the question is: Why does this work on the old laptops, works on my development PC regardless of what resolution I set the screen, but does NOT align properly on the new laptops?
Rectangle r = new Rectangle(2, 2, 20, 10); //left,top,width,heigth
int width = 5;
int top = 2;
int height = 10;
Bitmap bmp = new Bitmap(hourlyPictureBox.Width, hourlyPictureBox.Height);
Graphics g = Graphics.FromImage(bmp);
g.PageUnit = GraphicsUnit.Pixel;
for (i = 0; i <= 100; i++)
    r = new Rectangle(4 + (i * width), top, width, height); //left,top,width,heigth
   if (slot[i] == 0)
          g.FillRectangle(Brushes.White, r);
   if (slot[i] == 1)
          g.FillRectangle(Brushes.red, r);
      ........so on and so forth for all the colors
hourlyPictureBox.Image = bmp;
Hopefully a simple question for someone who knows what they are doing. :=)
Thank you in advance for your help in this matter.
Rob

Well.....after a couple of hours of frustration I found out that using floating # does not help. Everything had to work out to an integer so things would line up on each 15 minute increment.
I also never figured out how to loop thru and reference the radio buttons, so a bunch of hard coded crap fixed my problem.  Code is ugly, but works.
Thank you for heading me in the right direction to know what to look at. Devil is in the details.
if ((radioButton54.Left) - (radioButton30.Left) > 600)
                width = 7;
                offset = 12;
                radioButton2.Left = radioButton1.Left + (width * 4);
                radioButton3.Left = radioButton2.Left + (width * 4);
                radioButton4.Left = radioButton3.Left + (width * 4);
                radioButton5.Left = radioButton4.Left + (width * 4);
                radioButton6.Left = radioButton5.Left + (width * 4);
                radioButton7.Left = radioButton6.Left + (width * 4);
                radioButton8.Left = radioButton7.Left + (width * 4);
                radioButton9.Left = radioButton8.Left + (width * 4);
                radioButton10.Left = radioButton9.Left + (width * 4);
                radioButton11.Left = radioButton10.Left + (width * 4);
                radioButton12.Left = radioButton11.Left + (width * 4);
                radioButton13.Left = radioButton12.Left + (width * 4);
                radioButton14.Left = radioButton13.Left + (width * 4);
                radioButton15.Left = radioButton14.Left + (width * 4);
                radioButton16.Left = radioButton15.Left + (width * 4);
                radioButton17.Left = radioButton16.Left + (width * 4);
                radioButton18.Left = radioButton17.Left + (width * 4);
                radioButton19.Left = radioButton18.Left + (width * 4);
                radioButton20.Left = radioButton19.Left + (width * 4);
                radioButton21.Left = radioButton20.Left + (width * 4);
                radioButton22.Left = radioButton21.Left + (width * 4);
                radioButton23.Left = radioButton22.Left + (width * 4);
                radioButton24.Left = radioButton23.Left + (width * 4);
                radioButton25.Left = radioButton24.Left + (width * 4);
                st1.Left = radioButton1.Left - 4;
                st2.Left = radioButton2.Left - 4;
                st3.Left = radioButton3.Left - 4;
                st4.Left = radioButton4.Left - 4;
                st5.Left = radioButton5.Left - 4;
                st6.Left = radioButton6.Left - 4;
                st7.Left = radioButton7.Left - 4;
                st8.Left = radioButton8.Left - 4;
                st9.Left = radioButton9.Left - 4;
                st10.Left = radioButton10.Left - 4;
                st11.Left = radioButton11.Left - 4;
                st12.Left = radioButton12.Left - 4;
                st13.Left = radioButton13.Left - 4;
                st14.Left = radioButton14.Left - 4;
                st15.Left = radioButton15.Left - 4;
                st16.Left = radioButton16.Left - 4;
                st17.Left = radioButton17.Left - 4;
                st18.Left = radioButton18.Left - 4;
                st19.Left = radioButton19.Left - 4;
                st20.Left = radioButton20.Left - 4;
                st21.Left = radioButton21.Left - 4;
                st22.Left = radioButton22.Left - 4;
                st23.Left = radioButton23.Left - 4;
                st24.Left = radioButton24.Left - 4;
                pm13.Left = radioButton13.Left - 4;
                pm14.Left = radioButton14.Left - 4;
                pm15.Left = radioButton15.Left - 4;
                pm16.Left = radioButton16.Left - 4;
                pm17.Left = radioButton17.Left - 4;
                pm18.Left = radioButton18.Left - 4;
                pm19.Left = radioButton19.Left - 4;
                pm20.Left = radioButton20.Left - 4;
                pm21.Left = radioButton21.Left - 4;
                pm22.Left = radioButton22.Left - 4;
                pm23.Left = radioButton23.Left - 4;
                pm24.Left = radioButton24.Left - 4;
                radioButton31.Left = radioButton30.Left + (width * 4);
                radioButton32.Left = radioButton31.Left + (width * 4);
                radioButton33.Left = radioButton32.Left + (width * 4);
                radioButton34.Left = radioButton33.Left + (width * 4);
                radioButton35.Left = radioButton34.Left + (width * 4);
                radioButton36.Left = radioButton35.Left + (width * 4);
                radioButton37.Left = radioButton36.Left + (width * 4);
                radioButton38.Left = radioButton37.Left + (width * 4);
                radioButton39.Left = radioButton38.Left + (width * 4);
                radioButton40.Left = radioButton39.Left + (width * 4);
                radioButton41.Left = radioButton40.Left + (width * 4);
                radioButton42.Left = radioButton41.Left + (width * 4);
                radioButton43.Left = radioButton42.Left + (width * 4);
                radioButton44.Left = radioButton43.Left + (width * 4);
                radioButton45.Left = radioButton44.Left + (width * 4);
                radioButton46.Left = radioButton45.Left + (width * 4);
                radioButton47.Left = radioButton46.Left + (width * 4);
                radioButton48.Left = radioButton47.Left + (width * 4);
                radioButton49.Left = radioButton48.Left + (width * 4);
                radioButton50.Left = radioButton49.Left + (width * 4);
                radioButton51.Left = radioButton50.Left + (width * 4);
                radioButton52.Left = radioButton51.Left + (width * 4);
                radioButton53.Left = radioButton52.Left + (width * 4);
                radioButton54.Left = radioButton53.Left + (width * 4);
                et30.Left = radioButton30.Left-4;
                et31.Left = radioButton31.Left - 4;
                et32.Left = radioButton32.Left - 4;
                et33.Left = radioButton33.Left - 4;
                et34.Left = radioButton34.Left - 4;
                et35.Left = radioButton35.Left - 4;
                et36.Left = radioButton36.Left - 4;
                et37.Left = radioButton37.Left - 4;
                et38.Left = radioButton38.Left - 4;
                et39.Left = radioButton39.Left - 4;
                et40.Left = radioButton40.Left - 4;
                et41.Left = radioButton41.Left - 4;
                et42.Left = radioButton42.Left - 4;
                et43.Left = radioButton43.Left - 4;
                et44.Left = radioButton44.Left - 4;
                et45.Left = radioButton45.Left - 4;
                et46.Left = radioButton46.Left - 4;
                et47.Left = radioButton47.Left - 4;
                et48.Left = radioButton48.Left - 4;
                et49.Left = radioButton49.Left - 4;
                et50.Left = radioButton50.Left - 4;
                et51.Left = radioButton51.Left - 4;
                et52.Left = radioButton52.Left - 4;
                et53.Left = radioButton53.Left - 4;
                et54.Left = radioButton54.Left - 4;
            int top = 2;
            int height = 10;
            Bitmap bmp = new Bitmap(hourlyPictureBox.Width, hourlyPictureBox.Height);
            Graphics g = Graphics.FromImage(bmp);
            g.PageUnit = GraphicsUnit.Pixel;//??
            for (i = 0; i <= 100; i++)
                int w = width;
                int z = offset  + (i * width);
                //r = new Rectangle(4 + (i * width)), top, width, height); //left,top,width,heigth
                r = new Rectangle(z, top, w, height); //left,top,width,heigth
                if (slot[i] == 0)
                    g.FillRectangle(Brushes.White, r);
  ......so on and so forth
            hourlyPictureBox.Image = bmp;
            g.Dispose();

Similar Messages

  • The accursed little dark gray ball with white in the center and white arrows, either two or four, which seize control of the screen and move the text or pictures up, down, left, right and can be stopped only by finding the ball and clicking it. I want to

    The accursed little dark gray ball with white in the center and white arrows, either two or four, which seize control of the screen and move the text or pictures up, down, left, right and can be stopped only by finding the ball and clicking it. I want to stop the thing permanently. Firefox 3.6 and 3.64
    == This happened ==
    Every time Firefox opened
    == with 3.60

    The accursed little dark gray ball with white in the center and white arrows, either two or four, which seize control of the screen and move the text or pictures up, down, left, right and can be stopped only by finding the ball and clicking it. I want to stop the thing permanently. Firefox 3.6 and 3.64
    == This happened ==
    Every time Firefox opened
    == with 3.60

  • Custom Infotype - Using Table control in the screen.  IN OM

    Hi,
    I am having a requriement where in I need to create a custom infotype using table control in the screen. I have to create this in OM and I am using PPCI transaction to create the info type. I am able to create the infotype with fields but not table control. Please let me know if any one of you came across and help me with the process I need to follow.
    Thanks in advance.
    Venkat.

    Hello,
    After you create the info type throug PPCi, you can directly go to the Sceen module program created automatically while creating Info type and edit the screen.
    activate it after your changes.
    Regards,
    Srujan.

  • I am using my ipad 2 ( bought in USA)  for about 3 years. 2 weeks back the touch gesture was completely out of control and the screen  was jumping automatically to so many applications. I attempted to get original settings through settings menu, but unfor

    I am using my ipad 2 ( bought in USA)  for about 3  years. 2 weeks back the touch gesture was completely out of control and  the screen  was jumping automatically to so many applications. I  attempted to get original settings through settings  menu, but unfortunately while resuming when I typed a pass code the  touch gesture , without control it  typed unknown passcode and while  confirming the passcode as well same thing happened.
    Now my Iapd2 is disabled and itunes also not recognizing my ipad.
    I kindly request you to help me to fix the issue. 

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • I have imported videos to my lap top (Windows Vista), from my new ipad.  Quick time plays them with audio, however the screen is black. What is the fix?

    I have imported videos to my lap top (Windows Vista), from my new ipad.  QuickT
    ime plays them with audio, however the screen is black. What is the fix?

    Experimental advice (in this particular context) coming up.
    Open your QuickTime control panel (either via the Control panels, or by going "Edit > Preferences > QuickTime Preferences" in the Quicktime Player). In the Advanced tab, uncheck Enable Direct3D video acceleration:
    ... and click OK. Quit and restart the QuickTime Player prior to checking to see if the settings change has had any effect.

  • Hi, I hope someone can help.... When I open a new user account, which I want to set parental control on, the screen keeps freezing once the account is open. The wee rainbow circle appears and I can't do anything. Does anyone know how to fix this? Thanks

    Hi, I hope someone can help.... When I open a new user account, which I want to set parental control on, the screen keeps freezing once the account is open. The wee rainbow circle appears and I can't do anything. Does anyone know how to fix this? Thanks

    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at the top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair. Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)
    Report any errors it found for Disk Repair, don't need the ones for Permissions Repair.
    Try it again & see if anything changed, but have Activity Monitor open & Show All Processes & sorted on CPU%, also have Console open if we can... maybe not when switching, but we'll see.
    Does this happen if you just try to create a new admin user???

  • I opened my iPod Touch up to fix my home button. When i closed it back up it had a white screen. I tried pressing lock and home button for 10 seconds and it worked but while i'm using it it goes white with lines on the screen. Help please

    I opened my iPod Touch up to fix my home button. When i closed it back up it had a white screen. I tried pressing lock and home button for 10 seconds and it worked but while i'm using it it goes white with lines on the screen. Help please. This has been happening for a while and i've tried everything but it doesn't work.

    Try:
    fix for Home button
    iPhone Home Button Not Working or Unresponsive? Try This Fix
    - If you have iOS 5 and later you can turn on Assistive Touch it add the Home and other buttons to the iPods screen. Settings>General>Accessibility>Assistive Touch
    - If not under warranty Apple will exchange your iPod for a refurbished one for:
    Apple - Support - iPod - Repair pricing
    You can do it an an Apple store by:
    Apple Retail Store - Genius Bar
    or sent it in to Apple. See:
    Apple - Support - iPod - Service FAQ
    - There are third-party places like the following that will repair the Home button. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens

  • Issues with lines across the screen, as well as freezing

    Issues with lines across the screen, as well as freezing
    Hello all
    Got an iMac since January 2008 and I do like it a lot, even though it has some issues:
    -- It displays (quite often) lines partially across the screen
    -- Lines appear as well when opening applications or when menus come up
    -- The system freezes more than I like to admit (more than my Windows/Ubuntu box)
    I don't know if the freezing has to do with the lines that are shown on my screen. But I assume that both issues relate to some video card problem. I can't be sure - but that's what I assume from living with this issue day to day.
    The line on the desktop (most of the time it is there before login) I can always get rid of by changing the display resolution to something else and then changing it back. Normally the line is gone, or, reappears on a different spot on the desktop. But repeating the procedure removes the line.
    However, this does not mean that the lines are not showing up again when launching apps or displaying menus!
    And since those lines appear to happen randomly, I think it's safe to assume that we're not talking dead pixels here, either...
    About the freezing:
    My iMac freezes sometimes when I move the mouse around, when switching desktops using "spaces" or when the zoom function of the Dock kicks in. Sometimes the screen goes completely black, sometimes completely white. The mouse, however, always works. But the system requires a reboot.
    Again, this happens too often to feel comfy about it.
    With my little knowledge of Mac troubleshooting I assume that there's something wrong with the ATI card that's built into my Mac. On the other hand, some people say that they started getting similar issues after updating their OS to Leopard. Again other people say that such issues stem from an ATI revision that is too old and the Mac should get a new ATI card. And how would that work? Isn't that an "all-in-one" machine with everything soldered onto the mainboard?
    So, any help in this matter is greatly appreciated...
    Cheers,
    Rainer

    Here are a few screen photos I've taken (not screenshots, as the lines are not visible when taking screenshots. I used my digicam to snap those...).
    Here's the link to those screen photos displaying some of the many lines I keep having:
    http://picasaweb.google.com/rainer.rohde/NewAlbum62508115AM
    Needless to say, as I typed this message here, I had a nice line going across my Safari window..
    Cheers,
    Rainer

  • HT1349 i have just bought an ipad2 from usa. now i am in dia. i am a first timer user of ipad. i have charged for three hours, when i start iti.e. on the device it shows a plug in icon with itunes. then the screen turns black. i am not able to use the dev

    i have just bought an ipad2 from usa. now i am in india. i am a first timer user of ipad. i have charged for three hours, when i start iti.e. on the device it shows a plug in icon with itunes. then the screen turns black. i am not able to use the device. kindly help

    You need to plug the iPad into your computer that has iTunes installed on it, and activate it.
    The User Guide would be good for you to read:
    http://support.apple.com/manuals/#ipad

  • Refurbished iMac with OSx and the screen jumps/flickers about every 10 - 15 seconds.   Suggestions?  It often seems fine on start up .

    I recently got a refurbed iMac with OSx adn the screen jumps/flicks every 10-15 seconcds.  suggestions?

    If you purchased it from Apple, you are covered by the warranty - take advantage of it and call them as that appears to be a graphics issue.

  • HT201263 Hi, I forgot the password  of my iphone4s I tried more than ten times and it lock me out with a message to connect  the iPhone with itunes on the screen but the itunes doesn't  recognise it. What can I do?

    Hi, I forgot the password  of my iphone4s I tried more than ten times and it lock me out with a message to connect  the iPhone with itunes on the screen but the itunes doesn't  recognise it. What can I do?

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device
    1. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    2. iOS- Forgotten passcode or device disabled after entering wrong passcode
    3. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    4. iOS- Understanding passcodes
    5. What to Do If You've Forgotten Your iPhone's Passcode
    6. How to Recover Forgotten iPhone Restrictions Passcode | The iPhone and iPad
    7. Restoring iPod touch after forgotten passcode
    8. RecBoot: Easy Way to Put iPhone into Recovery Mode - if all else fails.
    Forgotten Restrictions Passcode Help
    1. How to Recover Forgotten iPhone, iPad Restrictions Passcode
        If this method does not work, then you will need to fully Restore your
        device as New
    Also, see iTunes- Restoring iOS software.

  • My Mac won't start up and Im using DiscWarrior. When I restart the computer with "c" down, the screen goes black. Is this ok? Do I just wait it out?

    my Mac won't start up and Im using DiscWarrior. When I restart the computer with "c" down, the screen goes black. Is this ok? Do I just wait it out?

    Have you just tried repairing with Disk Utility?
    Repair the Hard Drive and Permissions - Lion/Mountain Lion
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu. Select Restart from the Apple menu.

  • T540p freezes with bars across the screen

    I have a T540p with Win7 ultimate. It occurres randomly that all of the sudden it freezes and I get horizontal rectangles all accross the screen. Also on the speakers I get a 0.5sec loop noise.
    The only way to get it back in order is to do a hard reboot (press the power button until it switches off).
    Does anyone experience the same and even better - has a solution to that?
    Best regards,
    Severin Wanzenried

    by the way, it looks like this:
    Link to image
    Moderator comment: Image(s) converted to link(s). For helpful information, please see: About Posting Pictures In The Forums.

  • I have a problem related to the position of the data and controls on the screen - they have moved up under the time bar at the top of the screen and the rotation is locked messed up.

    This problem has only just appeared. When I call up a page in Firefox Home, from either the Tabs or Bookmarks group, the page appears vertically shifted up under the iPod time bar and two overlapping copies of the control bar appear at the bottom. I tried signing out and completely re syncing the data but that didn't fox the problem. Also when I try to rotate the screen, a rotated image appears underneath th original. This doesn't happen with any other app.

    I still don't have any idea what caused the problem. It didn't go away when I re-synced. However, when I completely shut down the iPod (64GB Gen4) by pressing and holding the ON/OFF button until it gave me the red 'slide to turn off' control, and then rebooting it from scratch the problem went away.
    It looks like there was some conflict between the system and the app that is going to be quite difficult to find. If it happens again I'll try to be more observant of the conditions and report more information.

  • Has anyone had issues with half of the screen going hay wire?

    I have a 24" LED cinema display. Purchased 09'. The first one I bought had one dead pixel and so they swapped that one out with this new one. For the past 2 years it has a great monitor until about 6 months ago it started distorting half of the screen. It would only do it so often but now its more persistent and more aggressive issue. I called Apple today and got a few options. They said it could be the board ( the cheap option ) or it could be the LCD panel ( the expensive option )
    I want to know if anyone has had this issue or anything like it and if so what was the solution? the board or the LCD panel?
    Take a look at the pictures from today.. http://img.photobucket.com/albums/v516/Josh-O-Wah/photo.jpg

    Right, I know that much. My question is how bad is the hardware issue.. I was hoping someone might have an idea if it was the mother board inside the monitor or if it was the LCD panel. One is 100 dollar fix the other is 600 dollar fix.. =T

Maybe you are looking for

  • Materials in project

    Hello Everybody, The material procurement and production scenario for project at my client's place is as follows For example, project structure has four WBS Elements as WBS 1, WBS 2, WBS 3, and WBS 4 Material procuremet for production occures under E

  • Music Configuration for IPhoto '08 - Slideshow

    Hello, when I make a slideshow in IPhoto 2008, and select my music, then export it into a .mov file, how can I show the same slideshow in another PC Computer WITH the music? Thanks.

  • Books/DVDs on Photoshop CS4 Extended

    Any books/DVDs on Photoshop CS4 Extended? Dennis Hallinan

  • Multi-user is disabled!

    Hi, I did something foolish by locking myself out of the system. Currently, I am only able to login as a single-user. Whenever I start the system, I am not able to login utilizing any of the user id's. I have tried serveral things including resetting

  • CSS how to get it to fit all Screens?

    Hey all! I am looking around online for sites to try and re-crate. its going great so far, they all turn out perfect. BUT. They don't fit on all Screens. I make them on my main rig, and it has a bigger screen than any other........I think you know wh