snarfblam
Leaders-
Posts
2156 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by snarfblam
-
For the express editions I believe that if you want to target a specific architecture, you need to download the express version specific to that architecture. Don't quote me on that though.
-
Here is a question: are you using VB with the application framework enabled (it is under Project/Properties in the menu)? For some reason, I think that this might have something to do with it.
-
Here are the two biggest things you can do to help (in my experience): (1)Comment. Anything you think won't be obvious a week from now (to you, for the time being forget about other programmers) should be commented. (2)Refactor. Later, go through and organize code more logically. Extract functions where you think it will be more readable, or inline them if you think it makes things simpler. Rename variables, put them into more appropriate scope, change functions to properties when it makes more sense, etc. And when you refactor, comment for yourself as well as anyone else who will see your code. That is how I program and produce something readable. And by using that process, during the refactoring stage (where you depend on the comments you made earlier) you can notice trends in your programming that you need to refactor repeatedly, change your style, and hence improve your programming.
-
I don't know about 2005, but in VS 2003 you could open up all win32 EXEs (even .Net exes after compilation) and edit resources, i.e. win32 resources as opposed to .Net resources, and add icons as well as other things.
-
It's a little more than used but in good shape. It is inspected to make sure everything is in optimal shape, and anything that is damaged in any way is replaced. Anything that is dirty or worn is cleaned or replaced. I would say that when the word is appropriately used it generally means "Slightly used but in new shape." Depending on the consumer, this definition might be a little flexible though.
-
I tried pausing from the IDE and it worked fine for me. Is the code editor highlighting a line of code when you break (a "call return", it will be a different color than active line and have an arrow in the breakpoint margin)?
-
My apologies. Excuse my plain wrongness, but I was under the ridiculous impression that (and still am not sure that I was wrong)...
-
I have considered the possibility of a tile-based 3D game, but unfortunately, 3D graphics do not generally lend themselves to tile-based environments. It would be incredibly complex to create "tiles" with vertecies expected to line up unless the "tiles" are very plain. I have seen two tile-based 3D games that I can think of. One is a Blaster Master sequel for PlayStation. The seams between the tiles were visible not only because the lighting and textures didn't line up exactly right, but also "jaggies" would sometimes cause faint dotted lines between tiles (which, in my experience, only becomes worse with anti-aliasing). Of course, there is the Sims, which uses an orthagonal projection, but the logic involved in joining walls, fences, and the ground at different heights is far from simple, not to mention that fences, walls, and floors can not be applied over ground with varying heights. So my advice on your 3D tiled game would be use an orthagonal projection and set aside lots of time. I'm not trying to discourage you; I just want to point out that there are some difficult challenges involved in what you want to do.
-
Don't wanna do that! That will add one and only one of the prices into the total (ElseIf chains will execute no more than one block of code: that for the first true condition it finds). If ckShirt.Checked Then _ 'add shirt cost If ckHat.Checked Then _ 'add hat cost If ckShoes.Checked Then _ 'add shoes cost
-
You can't make UpdateListView static because it references an instance member, listView1. Static methods can not access instance members. (How would the compiler know which instance you are referring to?) You need to pass Form1 to Test() so that Test can refer to an instance of Form1. Class Form1 { X x = new X(); TestListView() { x.Test(this) } UpdateListView() { listView1.Items.Add } } Class X() { Test(Form1 form) { //How do I call UpdateListView //Like this: form.UpdateListView() } }
-
Knowing almost nothing about your code, I would say that it might be possible that a logic error created an infinite loop which involved some kind of memory allocation. Kinda a stab in the dark.
-
As far as I know, your best bet is to manually combine the arrays... byte[] Array1 = { 1, 2, 3, 4, 5, 6 }; byte[] Array2 = { 7, 8, 9, 10, 11, 12 }; byte[] Array3 = new byte[12]; Array1.CopyTo(Array3, 0); Array2.CopyTo(Array3, Array1.Length); Unless you want to create your own function to do it for you... // Haven't tested this function static System.Array JoinArrays(System.Array Array1, System.Array Array2) { // Throw exception if array types don't match if(! Array1.GetType().Equals(Array2.GetType())) { throw new ArgumentException("Both arrays must be the same type"); } // Create resulting array System.Array result = System.Array.CreateInstance( Array1.GetType(), Array1.Length + Array2.Length); // Copy both arrays, end to end, in the resulting array Array1.CopyTo(result, 0); Array2.CopyTo(result, Array1.Length); // Return the combined arrays return result; }
-
Inverting Colors With Pens And/Or Brushes
snarfblam replied to music7611's topic in Graphics and Multimedia
You can modify the image, pixel for pixel, by yourself. You can achieve a major performance gain by using the System.Runtime.Interop.Marshal class to copy the image data to an array, edit the data in the array, and copy the image data back to the image. You might be also able to draw inverted colors using GDI through Windows API. -
How long does it take for a call to LoadMemos?
-
One drawback with this method is that all of the spare CPU power is spent on your application calling DoEvents(). The CPU will be made available when other applications need it, but the end user might notice some unusual behavior. If you look in the task manager you will see CPU usage jump to 100%. If the user has a variable speed CPU fan, he will hear it revving up although to him there is no appearent intense use of the CPU.
-
Capture a hidden window without making it top level?
snarfblam replied to thomas10001's topic in Graphics and Multimedia
I'll tell you what I know, which isn't much. In Windows generally the image for a window is only that which is stored on the screen, which means that if all or part of a window isn't visible, the image for the concealed portion does not exist. There must be a way, however, to have a form draw itself somewhere other than the screen because Microsoft offers an alt-tab replacement program which shows the image of the window you are tabbing to, even if it isn't visible (or completely visible). -
In the underlying .Net engine, a function must place its return value on the stack. If it does not, the code will not be verifiable. Depending on the end user's settings, this will cause the program to either not run at all, or simply crash, so it is important that a value is returned. If you are using VB, a default value is always placed on the stack. Allowing it to be returned could cause your program to crash. Most likely it will just produce odd or unexpected results. When you call a function it is expected behavior that the function will inspect input and provide a meaningful output. It is, therefore, considered good programming practice (or required programming practice in C#) that every possible code path explicitly returns a result so that a default value is not returned by accident. With reference types, a code path that returns a default returns a null reference, which may cause a NullReferenceException to be thrown, and without an exception handler in place, this will crash your application. With value types, these unexpected default values could cause exceptions due to overflow, out of bounds array access, division by zero, etc. In C# (at least 2.0, I'm not positive about 1.x) there is no provision for default values, therefore a value must be explicitly returned. Otherwise the resulting IL would be unverifiable and if allowed to run would crash the CLR.
-
I don't know many details from my (approximate) total of one hour programming Java, but let's address those short-comings of Java you guys mentioned.
-
There is a big difference between DrawRectangle and FillRectangle. Unless that's a typo, that would explain a little.
-
You are drawing 1581 rectangles, that is kinda alot. I don't know if there are any differences between the rectangles you drew in 9 ms and the ones you draw in 500. These are a few things that might speed stuff up a bit: -Make sure anti-aliasing is set to SmoothingMode.None for the graphics object -Try using a for loop instead of a foreach loop. I'm guessing that the for loop will be faster. I don't think it will help that much though. -Try using a jagged array. In .Net 1.x, the clr is optimized for one dimensional arrays, and jagged arrays are simply one-dimensional arrays of one-dimensional arrays. (Keep in mind that jagged arrays aren't CLS compliant so they shouldn't be publicly accessible) I don't know how much those suggestions will really help though. Square[][] arrGrid = new Square[31][]; void MakeSquareArray() { for(int i = 0; i < 31; i++) {Square[i] = new Square[51];} } public enum SquareType { Node, Link, Number } public enum LinkType { Unknown, Yes, No } for(int i = 0; i < 31; i++) { for(int j = 0; j < 51; j++) { Square sqTemp = Square[i][j]; if(sqTemp.Type == SquareType.Node) gBuffer.FillRectangle(Brushes.Black, sqTemp.Bounds); else if(sqTemp.Type == SquareType.Link) { if(sqTemp.Link == LinkType.Yes) { gBuffer.FillRectangle(Brushes.Black, sqTemp.Bounds); } else if(sqTemp.Link == LinkType.No) { gBuffer.FillRectangle(Brushes.Red, sqTemp.Bounds); } } } } Also, I haven't tested this code.
-
You need to find the average of the color channels. Assuming that this is an ARGB image stored in an array of Int32s (Integer), each Int32 holds information for the Alpha, Red, Green, and Blue channels. You probably want to maintain the Alpha channel, but Red, Green, and Blue channels should all be set to the average of the three. This is the quickest (to code) way that I can think of. Dim RGB As Int32 = OdArr(X, Y) Dim Alpha As Integer = RGB >> 24 RGB = ((RGB And 255) + ((RGB >> 8) And 255) + ((RGB >> 16) And 255)) \ 3 ODAnnR(X, Y) = Color.FromArgb(Alpha, RGB, RGB, RGB) I haven't tested this, though.
-
Read an array from a binary file
snarfblam replied to kcwallace's topic in Directory / File IO / Registry
You can read a whole bunch of bytes into a buffer (in this case our buffer could be an array of bytes). 'Let's load 100 bytes of data into memory in one read operation Dim MyStream As New IO.FileStream("MyFile", IO.FileMode.Open, IO.FileAccess.Read) Dim MyData As Byte() = New Byte(99) {} MyStream.Read(MyData, 0, MyData.Length) MyStream.Close()