
Cags
Avatar/Signature-
Posts
699 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Cags
-
If the item has key events then you can use the following. If it doesn't things will be a little more tricky. ' in key down event If e.KeyCode = Keys.Return Then ' do something End IfIf this isn't possible you could try setting the KeyPreview property of the form to true and using the forms key events, you will just have to try and check if the combobox has focus first. I can't really be much more specific as I'm using 2003 and so don't have a toolstrip control.
-
I believe setting focus in the form load event will not work because the Activated event is triggered after the load event, and that will bring focus back to the main form. So based on this assumption, if you declare Form2 publicly, then initialise it only if you need to, in the Activated event of Form1 check if Form2 = null if not the set focus to it.You probably also need a boolean to check its the first call to activated so that it doesn't keeep showing Form2 everytime you activate Form1. This all sounds abit messy, theres probably a better solution, but I can't think of one.
-
Are you sure it works correctly with the Messagebox bit uncommented? Looking at your code (aantal - 1) is the index of the last item. Your while loop iterates whilst teller is lower than the last items index. Therefore the last item is not copied over regardless of whether the Messagbox is shown or not. Assume aantal was 1, assumably you would want to copy over one item. 1 - 1 however is 0, which is not greater than 0 hence your loop is never entered.
-
Whilst still using the structure an alternative to the IComparer would be to add the files to the arraylist in order i.e for each file iterate through the array untill the date of the current file is greater than the one at the current index in the array. The IComparer class is certainly a better solution, I'm just providing an alternative.
-
Thats an interesting question. To the best of my knowledge when working within a class you should use the override method instead of using an attached event. I couldn't tell you with any accuracy why this is the case though. As an event allows an array of delegates I'm guessing if you attach one internally and then set the event as null externally it might remove it. I'm just hypothesising though I can't say for sure.
-
Yer, I failed to take into account something which was out of the control of the application, such as the lag from a http request. Oh well, it's not the first time and I'm sure it won't be the last.
-
Indeed you did. Good luck converting the code, it isn't complicated.
-
Assuming you wish to move in a direct line. One method is to calculate how many steps you wish to take, calculate how far the rectangle will move on each step. Then create a loop that operates for the amount of steps, on each loop move the offset the rectangles position and redraw. As this will happen near instantaneously you will need to pause for awhile too.// given Rectangle rect = new Rectangle (0, 0, 50, 50) Point target = new Point(200, 200) // create 8 movement frames Point totalOffset = new Point(target.X - rect.X, target.Y - rect.Y) Point movementVector = new Point(totalOffset.X / 8, totalOffset.Y / 8) for(int i = 0; i < 8; i++) { // shift the rectangle rect.Offset(movementVector); // assumes your paint code simply draws a rectangle at point rect Refresh(); // wait awhile before making next anim step System.Threading.Thread.Sleep(50); }Depending on what your doing depends on the actual loop method. Instead of a simple loop in this manner you could also use a timer and move on each tick untill at the required destination. Alternatively you could do the same thing but with a game loop that calculates its own framerate. In any case the theory is the same, calculate the displacement vector, then on each frame untill target is reached move your object.
-
The simple answer is you cannot draw over a control. There are hacks that will allow you to achieve various things such as have an odd shaped control or a transparent control that doesn't overlap more than one object. But to the best of my knowledge you cannot have a semi-transparent control that overlaps other controls.
-
Personally I've found the easiest way to serialise an Enum is by converting it to it's integer value. This is helpfull becaue C# allows us to cast enums too and fron their integer value. TestEnum myTestEnum = TestEnum.Two; int enumAsInt = (int)myTestEnum; TestEnum backAsEnum = (TestEnum)enumAsInt; public enum TestEnum { One, Two, Three } EDIT:-There is a built in function for doing this, I often work with the .Net CF which doesn't support it though so I nearly forgot about it. Check out the System.Enum.Parse() method.
-
Reading in a Block of Text [C#/CS]
Cags replied to Shaitan00's topic in Directory / File IO / Registry
Is there any reason your using an xml-ish style rather than just using xml. The XmlTextReader has built in parsers for doing such tasks, but will obviously require a valid xml structure. -
Instead of a count property arrays of this type have a length property. licArr.LengthIncidently you can probably add the strings to the combobox whilst avoiding the need to know the length. cboLicense.AddRange(licArr)
-
To the best of my knowledge, if you had two keyboards attached to the same PC then either, only one would work or more likely both would work the same. Basically they would both send the same messages so would be indistiguishable. If you wished to have two players from the same PC they would have to have different keys. But if the players are anything like me they would use the other keys to throw of your opponent, lol.
-
It shouldn't matter that it expects a generic object as a parameter, have you tried calling mruList.Remove(sender) or even mruList.Remove(item) both should work.
-
Does it not support a Remove property that accepts the actual ToolStripItem rather than its index?
-
I see no reason that using multiple-threads would neccessarily give you much of a speed gain, unless you have a system with multiple cpus. You say it requires multiple I/O events and I could see how in theory accessing multiple files simultaneously could yeild a speed benefit. But you are still dividing all resources between the threads. I would personally think that on a single cpu system working with multple files in a loop in a single thread would yield the same if not better performance. Perhaps theres something I'm missing? I'm sure one of the Guru's will clear the matter up soon enough.
-
Your quite right that did solve the problem. I'm curious as to why as I've used the ReadInnerXML method before without having issues with it. Perhaps the XmlTextRead behaves differently if nodes have no attributes or something. No matter it's working correctly now. Thanks.
-
Well I'm sorry, I'm not trying to accuse you of anything, but if its for your own use, then why do you need to make sure it stays open? Simply adding a shortcut to the startup folder of of the start menu will launch the application when you login. I see no real need for anything other than this for personal use.
-
Depends how serious you are about it, locking the user out completely is not really viable (plus you won't get help on these forums as its against policy). If you can clarify your position you made get help with a suitable solution though.
-
Websites such as Handango, PocketGear and ClickGamer provide reseller services for companies and developers. Basically what I'm wondering is what are the legal obligations for publishing your software though such systems. For instance if I develop an application or game in my own time and wish to try and make a profit from it, it is possible, as far as I can tell, to simply sign up to the sites and have the product online for sale in a matter of minutes. Obviously any money made would have to be declared as a taxable income, but what else needs to be done. Can software be sold under a company name without some kind of legal registration process? I.e. can you just start trading as "Cool Software" or would you just have to sell under your own name. Also where do you stand in terms of copyright. I believe anything you create which is unique is automatically copyrighted is this the case? I'm just interested to hear everyones opinions on anything even remotely related to this topic. I suspect it will vary somewhat dependent on what country you live in and whilst I'm from the UK, I'm still interested in hearing from any foreigners that care to add their 2p (or 10cents). Anyone who knows the sites I've listed at the top will notice they all specialise in mobile computing. I'm also interested in hearing peoples opinions on whether the .Net CF is a viable commercial mobile software development platform. Whether it be for games or applications.
-
I could be wrong, but I'd guess its for things like the Timer class. I believe this is a component, but it has no actually physical representation in a project like controls do.
-
If I try and import a standard .cs file from a normal project into a CF project I sometimes get the following error. "Resource transformation for file 'Class1.resx' failed. Invalid ResX input. Could not find valid "resheader" tags for the ResX reader & writer type names." The problem is not caused by any of the actual code in the .cs file, because if I create a new .cs file and copy/paste the code over it works without problems. Is there an easier fix than doing this? I found one solution, but that seems like alot of work, copying the code would be easier.
-
Displaying the moving object is the graphics part and the easier part of the two. Calculating the path is alot more complex (in my opinion) and has nothing todo with the graphics. You are unlikely to find a satisfactory answer to either of these questions without alot more details. A* is one of the more popular path finding algorithms, a search for this on google will provide thousands of hits.
-
What exactly do you need help with? calculating the path, animating the move or something else?
-
I tried it that way and it worked for a fair while, but then all of a sudden the toolbar is gone again. It's not even that it's just not visible, it doesn't appear on the toolbar list when you right click the toolbar. As for your suggestions mskeel, that would be overkill to say the least. I only use the line counter for two things really. Firstly most lines which contain comments and code in my applications need attention, its generally where i've commented out half a statement which needs either removing or replacing. Secondly I just like to know how big each class is, it's not really relevant in anyway, I just like to keep informed.