dcsimg
Results 1 to 1 of 1

Thread: [2005] TextureBrush X Y Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    26

    [2005] TextureBrush X Y Problem

    Have got this code

    Imports System.Drawing.Drawing2D

    Public Class MainForm
    Public MyTextureBrush As TextureBrush
    Public x, y, w, h As Integer

    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim MyBitmap As Bitmap
    MyBitmap = New Bitmap(PacmanPic.Image)
    MyBitmap.MakeTransparent(Color.Black)
    MyTextureBrush = New TextureBrush(MyBitmap, WrapMode.Clamp)
    End Sub

    Private Sub MainForm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    e.Graphics.FillRectangle(MyTextureBrush, x, y, w, h)
    End Sub

    Private Sub GoBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoBtn.Click
    Dim a As Integer
    MyTextureBrush.ResetTransform()
    For a = 1 To 384 Step 1
    MyTextureBrush.TranslateTransform(1, 0)
    x = a
    y = 0

    w = 44
    h = 34
    Me.Invalidate()
    Application.DoEvents()
    Next a
    End Sub
    End Class

    My problem is I cannot change x and y values. If I do change them either the image gets cut off or disapears. (E.g. Change y to 5 does not move the image down the screen.)

    Can somebody help please? Have uploaded project
    Attached Files Attached Files

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width