Jump to content
Xtreme .Net Talk

divil

*Gurus*
  • Posts

    3026
  • Joined

  • Last visited

Everything posted by divil

  1. The .NET framework doesn't provide any method to do this, but there are several libraries around on the internet (lots are free, too) that give you this functionality. Try searcing for the Magic Library.
  2. They're just the standard office icons you can find in VS.NET\Common7\Graphics. The translucency is added in code.
  3. Can you be more specific?
  4. divil

    encoding

    If you know how the file is encoded with the special characters, you can specify that encoding when you create the streamreader. Most of the constructor overloads support specifying the encoding. If you don't know what encoding it is, just try all of them.
  5. The best way is to draw it yourself, like I showed you.
  6. I'm guessing inno setup didn't include the windows installer bootstraps that install the latest version. The only file you actually *need* from the windows installer project is the .msi file, if you're willing to forget about the user having windows installer installed.
  7. The idea of doing your graphics manually means that whenever anything changes, you redraw everything. This may sound like a big deal but it really isn't. Putting all your drawing code in to one place (the Paint event of the form) gains you some performance benefits. Whenever something changes and you need to redraw, just call the Invalidate() method of the Form and it will raise its Paint event next time it's idle. As far as flickering is concerned, since you're doing all painting in the Paint event you can take advantage of Double Buffering to eliminate it. Look up the SetStyle function for how to do this.
  8. Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint Dim b As Brush b = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Panel1.Width, 0), Color.Black, Color.White) e.Graphics.FillRectangle(b, Panel1.ClientRectangle) b.Dispose() End Sub private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Brush b; b = new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0, 0), new Point(panel1.Width, 0), Color.Black, Color.White); e.Graphics.FillRectangle(b, panel1.ClientRectangle); b.Dispose(); }
  9. A Form object will be passed by reference no matter how you declare the parameter.
  10. I believe .NET requires IE 5.01. I deployed an application to a computer that just had IE 5 on it and experienced occasional crashes.
  11. divil

    Chr(10)

    You should use Environment.NewLine when you need to instead a newline in to a textbox or anything else. This keeps it platform independant.
  12. It's hardly Microsoft's fault you failed to remember that C# has escape characters in strings :)
  13. divil

    windir

    You can use Environment.SystemDirectory to retreive the path to the system directory, and use string manipulation or the methods of the Path class to get just the Windows directory from that. As far as I know there's no framework way to get just the Windows directory, but I'd like to be proved wrong.
  14. To find out more about attributes in .NET, consult the documentation. There is lots of information there.
  15. Well, it *does* gain you something. You shouldn't be using pictureboxes to display graphics for a game. There is no way of drawing on a different "layer" because they are all different windows. The solution is to do all your graphics painting on the form's surface, eliminating different windows and allowing you to do effects from transparency to transculency as you wish. I can see no other way of achieving what you want.
  16. A constructor isn't a very good place to put something like this. If you're instantiating a class, it implies that you want to go all the way through instantiating it. You can probably close the application in the form's Load event, which will be called just after the constructor executes. Failing that, close the application in your Main function, before the form even gets instantiated.
  17. Personally I'd use international date format, i.e. yyyy-mm-dd. That tends to be interpreted correctly by most things.
  18. There's a chance that it can, and I'm not sure which way I'd go about doing it if I were faced with the task. On the one hand once might be able to leverage the existing treeview layout engine and modify it, and on the other hand you could write it all yourself, but at least you'd know that you could do it. A deadline of mid march for this project would scare me a little. Good luck :)
  19. Both techniques are essentially the same. The image gets encoded the same, and embedded in the executable the same. The image is copied and embedded in both cases, so the original image file is not a dependancy. I'm pretty sure the image format is maintained too, I've often used embedded gifs because I needed the transparency channel.
  20. Why on earth would you want to do something like that?
  21. You can't, in the constructor. If there is a chance the object creation might fail, use a static public function to instantiate the class and make the constructor private, like the Graphics class. You can then return null (Nothing in VB) if it fails.
  22. You could try simply using .BringToFront() on the one you need. I don't see why they should flicker using either method, to be honest. There should be no redraw until you've finished showing and hiding.
  23. You could try using the InvalidateRect API on the Desktop window, that ought to force a redraw.
  24. It's difficult because windows are rectangles, purely and simply. You can fake limited transparency but that's just the way it is. You have also made life more difficult for yourself (yet easier in another respect) by using pictureboxes. If you were doing all your drawing manually in the Paint event, this would not be a problem as you could draw with transparency just fine. If I had to recommend something, it would be that you do all your drawing in the Paint event and don't rely on pictureboxes to display graphics.
  25. Anything you draw on a picturebox is essentially temporary. It isn't stored anywhere, it's just displayed on the screen. This is important for performance purposes. If you want to do something like you are trying to do, you need to create an offscreen bitmap. This is easy enough using the Bitmap class. You can get a graphics object from that bitmap using Graphics.FromImage() and draw on it. Once you have drawn on it you are free to assign it to a picturebox if you like, to display it. You do this with the picturebox's Image property. If you want to use DrawImage to draw a portion of your offscreen bitmap to another Graphics object, you can also do so. Several overloads for Graphics.Drawimage allow you to specify a source rectangle to blt from.
×
×
  • Create New...