Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27186

[RESOLVED] Linking Graphics.DrawImage Names

$
0
0
Hi Guys!

I hope I can explain what I need. Here is the thing:
I have this
Name:  Capture.PNG
Views: 186
Size:  396.5 KB
by this code
Code:

Private Sub ImageExampleForm(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        Dim newImage1 As Image = Image.FromFile("H01.png")
        Dim newImage2 As Image = Image.FromFile("C01.png")
        Dim newImage3 As Image = Image.FromFile("D01.png")
        Dim newImage4 As Image = Image.FromFile("S01.png")
        Dim x As Single = 111.0F
        Dim y As Single = 154.0F
        Dim width As Single = 225.0F
        Dim height As Single = 313.0F
        e.Graphics.DrawImage(newImage1, x, y, width, height)
        e.Graphics.DrawImage(newImage2, x + 38, y, width, height)
        e.Graphics.DrawImage(newImage3, x + 76, y, width, height)
        e.Graphics.DrawImage(newImage4, x + 114, y, width, height)
    End Sub

But I will have the all 52 cards deck so I want to change x positioning command like this:
Code:

e.Graphics.DrawImage(newImage2, (newImage&"own image number"-1.x position + 38), y, width, height)
I mean every image will be drawn to the +38 pixel right of the previous one -instead of writing +38, +76, +114, etc...

Thanks a lot!
Attached Images
 

Viewing all articles
Browse latest Browse all 27186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>