Jump to content
Xtreme .Net Talk

Volte

*Experts*
  • Posts

    2372
  • Joined

  • Last visited

Everything posted by Volte

  1. Actually, you may not need to do it that way. Look in your MSDN for 'resources samples' (search using the index) and you'll see some examples there. There is quite a lot of documentation in the MSDN if you just search around a bit. Myself, I've never used resources much, so I can't really help you here.
  2. MessageBox.Show(Convert.ToString(32, 16))Will show "20".
  3. You'll need to use Assembly.GetExecutingAssembly.GetManifestResourceStream("projectname.filename.ext")to return a Stream (you can probably put it into a FileStream), which you can then save to disk and then load it like a normal file. Just delete it when you are done.
  4. Debug configurations mean that the EXE has debug symbols in it; this allows the .NET IDE to stop at breakpoints and set watches and all that. If you are not planning on debugging the application, you should compile it for Release. It makes the app smaller and possibly faster.
  5. What's the error?
  6. You might want to look into using XML Serialization. That way you could create a GameState class or something, store the current level, score, and anything else you want to save, and simply serialize it into an XML file. Then you just deserialize it back into a GameState object when you are ready to get the data again, and use the properties of the class. Look in the MSDN for information about XML Serialization for that. However, if you just want to save it in a file, there are many examples in the MSDN as well. Look for the StreamReader and StreamWriter classes, as well as the System.IO namespace.
  7. &H20& is hex for 32. Integer.Parse takes a string value and converts it to an integer. I'm not so sure that dynamic_sysop's example is exactly what Kurt wants, since &H20& is recognized by VB as a number regardless of being parsed. You need to use Convert.ToInt32() and specify the base. MessageBox.Show(Convert.ToInt32("20", 16))Will show 32. Note you shouldn't include the &H part.
  8. No need. Put all your Question subs inside a class, create an instance of it, and then you can use this function: Private Sub MethodByName(ByVal obj As Object, ByVal method As String, ByVal args As String()) Dim t As Type t = obj.GetType t.InvokeMember(method, Reflection.BindingFlags.InvokeMethod, t.DefaultBinder, obj, args) End SubTo call each function by its name. So some code like this would work: Dim q As New Questions() 'Questions being the class containing all the Question subs. MethodByName(q, "Question" & myNumber, New String())
  9. Also, I edited your code, to change it so that it only draws in the form's Paint event (as it should be), made it so that instead of calling draw() it calls this.Invalidate(), and also turned on the UserPaint, AllPaintingInWmPaint, and DoubleBuffer styles for the form, and the FPS shot up to about 181. Still went down to about 13 at fullscreen (1600x1200). It also updated the tiles when you resize the form more smoothly; there's no "jumpy" effect.
  10. I get 115 on my GeForce 3. :) However, at fullscreen, it drops to 9.
  11. You need to make sure that System.Drawing.dll is referenced and imported in your project. Also, if you are going to do that, you should put all your code in the form's Paint event. Then, instead of using Me.CreateGraphics(), you use the Graphics objects passed into it. So it'd be something like this: Private Sub FormPaint(sender As Object, e As PaintEventArgs) Handles MyForm.Paint Dim g As Graphics = e.Graphics 'the graphics object of the form is passed in the PaintEventArgs g.FillRectangle(Brushes.Red, 10, 10, 1, 1) End SubTo force the form to redraw, use Me.Invalidate() and the Paint event will be called. For best performance, you should never do any painting outside of the Paint event.
  12. What do you want to SetPixel onto? A Graphics object? A bitmap? You can SetPixel on a bitmap with the Bitmap.SetPixel method Dim bmp As New Bitmap("C:\mybitmap.bmp") bmp.SetPixel(10, 10, Color.Red) 'color the pixel at (10, 10) red If you want to color a pixel on a Graphics object, you'll need to draw a small rectangle: Dim g As Graphics = Me.CreateGraphics() g.DrawRectangle(Brushes.Red, 10, 10, 1, 1) 'Draw a 1x1 rectangle at (10, 10)
  13. 1) In my VS.NET, Control-Space brings the auto-complete/intellisense box up. Just press it while typing and it'll either complete the word (if there is only one object beginning with the letters you've typed so far), or bring up the intellisense list starting with the letter combo you've typed. 2) What aewarnick said. :p
  14. GetHBitmap gets the bitmap handle of the bitmap. When you dispose of the image, the handle becomes invalid.
  15. That's a pretty cheesy thing to do. :p Also, highly unnecesary, when this will do: if (x < 0) MessageBox.Show("the value is less than zero!"); else MessageBox.Show("the value is greater than zero!");Unless you are looking at the value of one variable, and comparing it to many others (3+ more), if statements are generally cleaner than switch statements.
  16. Did you try closing the Form Designer (with the X, not just going to a different window) and re-opening it? That will force re-initialization of the designer.
  17. You need to create a GetThumbnailImageAbort delegate sub. It's ignored so it doesn't much matter: Private Function ThumbCallback() As Boolean Return False End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim big As Image, small As Image Dim callback As New Image.GetThumbnailImageAbort(AddressOf ThumbCallback) '.... small = big.GetThumbnailImage(10, 10, callback, IntPtr.Zero) End Sub
  18. Try using the Image.GetThumbnailImage method.
  19. Is the InitializeComponent sub being called from your form's constructor? Paste your form code here, please.
  20. Just to clarify: DirectX is a package of other smaller libraries, such as DirectDraw, DirectSound, DirectMusic, DirectInput, and Direct3D. When you use any of those, you are using DirectX.
  21. Are you using ASP.NET? :confused:
  22. It's not. I've tested. The API is much faster (for simple operations at least). I drew 2000 pictures on the form with GDI+ and it took like 500ms, and the same with GDI32 took about 200ms. However, in a real game situation with texturebrushes, solidbrushes, bitmaps, text, and the whole bit being rapidly drawn on the screen, it's possible the speed gap would get smaller or disappear. I'm not totally sure how GDI32 scales to meet larger tasks. However, the capabilities of GDI+ and the GDI+ objects in general (even just the fact that there are real GDI+ objects) made it totally worth it for most situations.
  23. Public Shared Function number(ByVal n as Integer) As Integer Return n + 1 End Function ' You don't need to declare an instance first since I made the function "Shared". x = Add.Number(x) MessageBox.Show(x)I don't think changing a ByVal parameter has any effect.
  24. Doesn't look very in-depth, but you might get something out of this. Couldn't find anything other than that.
×
×
  • Create New...