Results 1 to 4 of 4

Thread: can someone look at this code for me?{resolved}

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    can someone look at this code for me?{resolved}

    First of all, what I want to do is draw simple things such as rectangles to a bitmap because, if you use creategraphics() the graphics dissapear after being minimized or moved. I sort of know how to go about doing this but my code is not working. The graphics are not showing up when I try to draw to a bitmap. Here's my code...

    Dim bmp As New Bitmap(222, 222)
    Dim grfx As Graphics = Graphics.FromImage(bmp)
    Dim rect As New Rectangle(123, 211, 80, 90)
    grfx.DrawRectangle(Pens.Blue, rect)



    Can anyone tell me what I am doing wrong?
    Any help is appreciated.
    Last edited by System_Error; May 21st, 2004 at 05:22 AM.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    are you actually displaying the bitmap on something? because you won't see the bitmap unless you specify what to display it on.
    eg: a picturebox's image ...
    VB Code:
    1. Dim bmp As New Bitmap(222, 222)
    2. Dim grfx As Graphics = Graphics.FromImage(bmp)
    3. Dim rect As New Rectangle(123, 211, 80, 90)
    4.  
    5. Dim p As New Pen(Color.Blue , 5) '/// added this in ( to specify the width of the rectangle also )
    6. grfx.DrawRectangle(p, rect)
    7. PictureBox1.Image = bmp '/// set the image to a picturebox
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111
    Thank you very much. I feel really stupid for not knowing that though.

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you are NOT stupid , you are human and we all do these things from time to time
    ps. if it's resolved can you add resolved to the topic title
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width