Results 1 to 5 of 5

Thread: mobile application-Images as background-

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    15

    mobile application-Images as background-

    Hi all,
    i'm working on .NET Compact Framework using VB.
    i found this code, it puts the image as a background on the form.
    HTML Code:
    Protected Overrides Sub OnPaint(e As PaintEventArgs)
    
        ' Get image compiled as an embedded resource.
        Dim asm As Assembly = Assembly.GetExecutingAssembly()
        Dim backGroundImage As New Bitmap(asm.GetManifestResourceStream("mypicture.bmp"))
        
        e.Graphics.DrawImage(backgroundImage, Me.ClientRectangle, _
            New Rectangle(0, 0, backgroundImage.Width, backgroundImage.Height), _
            GraphicsUnit.Pixel)
    
    End Sub   
    this code is giving me an error: no valid namespace.

    any help?
    and is this code useful to load an image that is stored outside as a background?

    thanx.

  2. #2
    New Member
    Join Date
    Apr 2009
    Posts
    13

    Re: mobile application-Images as background-

    Maybe you could just use a PictureBox as a background? It's crude, but pretty effective.

  3. #3
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: mobile application-Images as background-

    This was also answered in another thread

    http://www.vbforums.com/showthread.php?t=567088
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  4. #4
    New Member
    Join Date
    Apr 2009
    Posts
    13

    Red face Re: mobile application-Images as background-

    Ok, thanks. I didn't notice the other thread.

  5. #5
    Member
    Join Date
    Apr 2009
    Posts
    47

    Re: mobile application-Images as background-

    Quote Originally Posted by ranabis View Post
    ' Get image compiled as an embedded resource.
    Dim asm As Assembly = Assembly.GetExecutingAssembly()
    Dim backGroundImage As New Bitmap(asm.GetManifestResourceStream("mypicture.bmp"))
    I had similar issue and it turned out to be the "path" to the image. For example my image was stored in a folder named images and so the path was:

    ...As New Bitmap(asm.GetManifestResourceStream("images/picture.bmp"))

    HTH, Magohn

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