Here's the sample code for what I'm trying to do. I actually have a 2D array. It's an array of pictureBox arrays. If you picture it like a grid with rows and columns. I want to foreach row, I want to shift each column back one, and set the first element to a new image. Here's the code (two for loops) // Shift the lane to the right // // Loop through each array (row) // for(int i = 0; i < allLanes.Length; i++) { // Loop through each element in the array (column) // // From back to front // for(int j = allLanes[i].Length-1; j > 0; j--) { // If the previous element's image is the failed image // if(allLanes[i][j-1].Image == failImg) { // Set the previous element to a pass image // allLanes[i][j-1].Image = passImg; // Set the current elemtn to a fail image // allLanes[i][j].Image = failImg; } else { // Set the current element to a pass image // allLanes[i][j].Image = passImg; } // Thread.Sleep(1); // } Note the Thread.Sleep(1). If I remove this, the code start to bomb out saying either: System.Drawing element is in use elsewhere or sometimes the display simply doesn't finish updating with only some of the rows showing the shift.
cmarcus
Posts
-
Array Shift Register -
Array Shift RegisterI've got a very large array of picture boxes that I'm trying to shift with out using a loop. I've tried looping through the array from last element to first, setting the prior element to the current element, however this takes too long. Basically I want to take the properties from elements [0] to [array length - 1] and set them to elements [1] to [array length]. And then take element [0] and update it programically. I'm trying to use the Array.CopyTo function, where I copy to a temp array but haven't had any success. Can anyone help!?!?
-
Simple Open File With... QuestionI'm trying to open a file pragmatically with an application that is not the default and with out setting it as a default. For example: I have a myfile.bmp. My default photo viewer is Microsoft Fax Viewer, but I want to open it with Microsoft Paint with out setting Microsoft Paint as the new default. I've been playing with Process.Start("myfile.bmp") but can't seem to get anything to work. Any help would be appreciated Best Regards -Chris
-
Setup & Deployment - File AssociationI'm trying to get my deployment project to automatically associate a certain file extension with my .exe. When I run my installer, the program installs normally, and all files with my desired extension change to an icon representing my applcation. When I double click these files, my application loads as expected. The problem is when I right click one of these files, and select open with. The icon is blank, and the description of the application used to open it is empty. My question is, in the setup and deployment project, where is the area where I place a target icon and a description, so that it will show up on the "Open With" list of file associations? Also does anyone know how to clean the "Recommended Programs" list in this menu? Thanks, -Chris
-
Get file that spawned the application.What was working is now not! I'm not exactly sure where the problem resides, but after I built my installer, and installed the application on my PC everything seemed to be fine. Then when I click the log file to analyze, it keeps opening back up using notepad. So I went to Open With.., and browsed to my .exe, and checked the option to always open files with this extention. When I double click the file now I get a critical error stating that the LOG file I double clicked and it's path is not a valid Win32 Application. How do I reset the target so that when I click the log file, it uses my .exe as the application?
-
Get file that spawned the application.Got it.. Seems to be working great! Thanks a lot!! -Chris
-
Get file that spawned the application.Hey Ya'll.. I'm building a little analyzer utility that will analyze text files automatically. Currently you have to click the Open Files button to load a file to analyze. I'd like to mod this program so that if you double click the file you want to analyze, it will spawn the analyzer and automatically analyze the contents of the clicked file. I've set my PC to always Open With the analyzer when you click on the files with my extension, but I'm at a loss on how to get the filename / path of the file that spawned it. Can anyone point me in the right direction? Thanks in advance -Chris
-
File.Copy QuestionI have a file that is being written to using stream writer. The file is written in frequent, random intervals. If I were to use a seperate application to grab a copy of this file (using File.Copy), would there be a chance the two applications would collide, while trying to perform operations on the same file? Or is the File.Copy method independant of whether the file is in use.. meaning I'd get the most recent copy from the last stream writer update? Any help would be appreciated!