Jump to content
Xtreme .Net Talk

PhilH

Members
  • Posts

    18
  • Joined

  • Last visited

Personal Information

  • Visual Studio .NET Version
    vb.net standard
  • .NET Preferred Language
    vb.net

PhilH's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Well what do you know! Thanks .
  2. So would drawing a 40MB bitmap in memory be considered ridiculously large? Is there any way to find out how much RAM memory a program uses?
  3. I have a question about memory usage. I draw a bitmap in memory that is tiled from sections of another bitmap stored on the hard disc. The tiled bitmap (tbm) is much larger than the picturebox it is displayed in so that I need to scroll the image. My current approach is to draw in memory only that section of tbm that can be seen in the picturebox and as the user scrolls the image redraw as necessary. If I make tbm larger than the the picturebox then this will cut down the amount of drawing, eg. I may only have to redraw every 10th scroll event. My problem is that I don't have any feel for how much memory I can use before I start to affect performance, ie. how large can tbm be? If I have 512 meg RAM and the program is running under Windows 2000 how much spare capacity do I have?
  4. You could try something like: Dim bmpc As New Bitmap("C:\bmpc.bmp") Dim pixelColor As Color = bmpc.GetPixel(e.X, e.Y) If pixelColor.G = 255 Then 'or whatever your value is 'etc
  5. Thanks for the info. I'll try your suggestions and work around the problem.
  6. I have a text box that displays the cursor coordinates for the form mousemove event: Textbox1.Text = (Cursor.Position.X & " " & Cursor.Position.Y) The form occupies the whole screen area. The screen width is 1024 pixels but I notice that if the mouse is moved very quickly off the edge of the form then the textbox display doesn't keep up. For example the last x value displayed can be as low as 900 depending on how fast I move the mouse sideways. Can someone explain why this should happen??
  7. I assigned a blank bitmap object of the correct size to picturebox.image . I then created a graphics object as you suggested. However the but the drawing Is still done onto the the graphics object , not onto the bitmap in picturebox.image.
  8. Sorry my code came garbled. Let me try again.. I am drawing in the paint event of the pictureBox. I have an array of "Tile" objects called TileArray, then: Dim I As Integer = 0 Dim J As Integer = 0 Dim b as New Bitmap (C:\sourcebitmap.bmp) For I = 0 To TileArray.GetUpperBound(0) For J = 0 To TileArray.GetUpperBound(1) e.Graphics.DrawImage(b, TileArray(I, J).XPosition, TileArray(I, J).YPosition, TileArray(I, J).SourceRectangle, GraphicsUnit.Pixel) Next J Next I This displays ok, but how do I assign the display to PictureBox.image ?
  9. I am drawing in the paint event of the pictureBox. I have an array of "Tile" objects called TileArray, then: Dim I As Integer = 0 Dim J As Integer = 0 Dim b as New Bitmap (C:\sourcebitmap.bmp) For I = 0 To TileArray.GetUpperBound(0) For J = 0 To TileArray.GetUpperBound(1) e.Graphics.DrawImage(b, TileArray(I, J).XPosition,_ TileArray(I, J).YPosition, TileArray(I, J).SourceRectangle,_ GraphicsUnit.Pixel) Next J Next I This displays ok, but how do I assign the display to PictureBox.image ?
  10. You are right. When I assign a bitmap to Picturebox.image explicitly.I can acess the pixel color. However the bitmap displayed in the pictureBox is produced by using e.Drawimage to tile regions of another bitmap, it doesn't exist as a file on disc. Is there any way to assign the bitmap displayed to the PictureBox.Image property?
  11. I tried that but received the error message "Object reference not set to an instance of an object". I presume this means that PictureBox1.Image doesn't exist?
  12. I am drawing a tile map onto a pictureBox. In the paint event of the PictureBox I declare a bitmap: Dim screendisplay as New Bitmap (C:\sourcebitmap.bmp) Where sourcebitmap is the file holding my tiles. I then draw the tile map by using e.DrawImage , a loop and an array to assign different regions (ie the tiles) of sourcebitmap to the picturebox surface. When the user clicks on the display I want to retrieve the colour of the pixel clicked. To do this I need (I think) a bitmap object that represents the screen display. How can this be done?
  13. There is a PictureBox sitting over the area of the form where the square is drawn. The PictureBox backcolor is set to transparent . When I used : Dim g As Graphics = Me.CreateGraphics g.DrawRectangle(Pens.Blue, New Rectangle(50, 50, 100, 100)) in the form paint event, the square was not visable through the PictureBox. But when I used: e. DrawRectangle(Pens.Blue, New Rectangle(50, 50, 100, 100)) in the form paint event the square is visable.
  14. PhilH

    ArrayList

    Is it possible to have a multidimensional ArrayList?
  15. Thanks , you solved my problem. Knowing what was meant to happen I had another look at my code. I actually don't have anything in the PictureBox, I just wanted its 3d border to provide a frame around something I am drawing onto the form. In the form paint event I had (I'm new at this!): Dim g As Graphics = Me.CreateGraphics g.DrawRectangle(Pens.Blue, New Rectangle(50, 50, 100, 100)) The square dosen't show through. When I changed it to: e. DrawRectangle(Pens.Blue, New Rectangle(50, 50, 100, 100)) The square shows through!
×
×
  • Create New...