Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    49

    Colorare percorso della pallina!

    Ciao, ho creato questo scherzo...faccio il printscreen del monitor e vi è una pallina che vi rimbalza dentro...solo che vorrei a questo punto che il percorso della pallina fosse colorato/cancellato...mi date una mano
    Grazie in anticipo
    Alex


    ______
    Option Strict Off

    Imports System.Drawing

    Imports System.Drawing.Drawing2D

    Imports System.Windows.Forms



    Public Class Form1

    Inherits System.Windows.Forms.Form



    Private Const BALL_WID As Integer = 50

    Private Const BALL_HGT As Integer = 50

    Private m_Dx As Integer

    Private m_Dy As Integer

    Private m_X As Integer

    Private m_Y As Integer



    Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _

    ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



    Dim pippo As Image

    keybd_event(Windows.Forms.Keys.PrintScreen, 0, 0, 0)

    pippo = Clipboard.GetImage()

    Me.FormBorderStyle = 0

    Me.BackgroundImage = pippo





    Dim rnd As New Random

    m_Dx = rnd.Next(1, 4)

    m_Dy = rnd.Next(1, 4)

    m_X = rnd.Next(0, Me.ClientSize.Width - BALL_WID)

    m_Y = rnd.Next(0, Me.ClientSize.Height - BALL_HGT)



    Me.SetStyle( _

    ControlStyles.AllPaintingInWmPaint Or _

    ControlStyles.UserPaint Or _

    ControlStyles.DoubleBuffer, _

    True)

    Me.UpdateStyles()



    End Sub



    Private Sub tmrMoveBall_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrMoveBall.Tick

    m_X += m_Dx

    If m_X < 0 Then

    m_Dx = -m_Dx



    ElseIf m_X + BALL_WID > Me.ClientSize.Width Then

    m_Dx = -m_Dx



    End If



    m_Y += m_Dy

    If m_Y < 0 Then

    m_Dy = -m_Dy



    ElseIf m_Y + BALL_HGT > Me.ClientSize.Height Then

    m_Dy = -m_Dy



    End If



    Me.Invalidate()



    End Sub



    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint



    e.Graphics.FillEllipse(Brushes.Blue, m_X, m_Y, BALL_WID, BALL_HGT)

    e.Graphics.DrawEllipse(Pens.Black, m_X, m_Y, BALL_WID, BALL_HGT)

    'e.Graphics.Clear(BackColor)

    End Sub



    End Class

    torna indietro

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    49
    Nessuna idea ?..possibile che non ci sia un modo semplice per colorare il percorso ?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.