CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2014
    Posts
    16

    Calling sub/function during bitmap creation.

    Hey, I think this is an easy one.

    I am making a large bitmap from several data sources with some logic and think it would be nice to keep the different streams in sub programs but I don't know how to pass the parameters (i think that's the term) to the sub and then back.

    Any help appreciated.

    Here is a simple example of what I need. There seems to be an option of writing the bitmaps to files and then joining them but that may not be an optimal choice.

    Dim b As New Bitmap(400, 400)
    Dim g As Graphics = Graphics.FromImage(b)

    g.DrawEllipse(Pens.Red, New RectangleF(33.33, 0, b.Width, b.Height))
    g.DrawEllipse(Pens.Red, New RectangleF(223.33, 0, b.Width, 222))
    g.DrawLine(Pens.Red, 0, 0, 44, 44)

    'call sub or function to draw something else

    PictureBox1.Image = b
    'b.Save("c:\temp.bmp")
    g.Dispose()

  2. #2
    Join Date
    May 2014
    Posts
    16

    Re: Calling sub/function during bitmap creation.

    Sorry, that was too simple.



    Call button3again(g)

    ------------------------------------------------------
    Private Sub button3again(ByVal g)

    g.DrawLine(Pens.Red, 0, 0, 44, 200)


    End Sub

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Calling sub/function during bitmap creation.

    Check out the differences between ByVal and ByRef. Would ByRef be more appropriate in your case?

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

Featured