イベント用のサブの作り方 への返答

投稿で使用できる特殊コードの説明。(別タブで開きます。)
本名は入力しないようにしましょう。
投稿した後で削除するときに使うパスワードです。返答があった後は削除できません。
返答する人が目安にします。相手が小学生か社会人かで返答の仕方も変わります。
最初の投稿が質問の場合、質問者が解決時にチェックしてください。(以降も追加書き込み・返信は可能です。)
※「過去ログ」について書くときはその過去ログのURLも書いてください。

以下の返答は逆順(新しい順)に並んでいます。

投稿者 にぃや♪  () 投稿日時 2008/11/24 01:51:36
ちょっと、いじったら暴走しました
別口で勉強します。
助言ありがとうございました。
投稿者   (社会人) 投稿日時 2008/11/24 00:31:49
>eの渡し方とかsenderも。
eとsender丸ごと渡すぐらいならイベントプロシージャを共通化しちゃいなYO
http://homepage1.nifty.com/rucio/main/dotnet/shokyu/standard10.htm
投稿者 にぃや♪  () 投稿日時 2008/11/23 23:39:16
サンプルエディターを作って、勉強の糧にしたいと思ってます。
 Private Sub PictureBox2_Paint(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox2.Paint
        Dim g As Graphics = e.Graphics
        Dim trnsRedBrush As New SolidBrush(Color.FromArgb(&H78FF0000))
        Dim trnsGreenBrush As New SolidBrush(Color.FromArgb(&H7800FF00))
        Dim trnsBlueBrush As New SolidBrush(Color.FromArgb(&H780000FF))
        Dim triBase As Single = 100
        Dim triHeight As Single = CSng(Math.Sqrt((3 * (triBase * _
        triBase) / 4)))
        Dim x1 As Single = 40
        Dim y1 As Single = 40
        g.FillEllipse(trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight)
        g.FillEllipse(trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, _
        2 * triHeight, 2 * triHeight)
        g.FillEllipse(trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, _
        2 * triHeight)
    End Sub

    Private Sub PictureBox3_Paint(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox3.Paint
        Dim myRect As New Rectangle(20, 20, 200, 100)
        Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
        Color.Red, 0.0F, True)
        e.Graphics.FillEllipse(myLGBrush, myRect)
        Dim transformArray As Point() = {New Point(20, 150), _
        New Point(400, 150), New Point(20, 200)}
        Dim myMatrix As New Matrix(myRect, transformArray)
        myLGBrush.MultiplyTransform(myMatrix, MatrixOrder.Prepend)
        e.Graphics.FillEllipse(myLGBrush, 20, 150, 380, 50)
        myLGBrush.ResetTransform()
        e.Graphics.FillEllipse(myLGBrush, 20, 250, 200, 100)
    End Sub

    Private Sub PictureBox4_Paint(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox4.Paint
        Dim x As Integer = 20
        Dim y As Integer = 20
        Dim h As Integer = 100
        Dim w As Integer = 200
        Dim myRect As New Rectangle(x, y, w, h)
        Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
        Color.Aquamarine, 45.0F, True)
        e.Graphics.FillEllipse(myLGBrush, x, y, w, h)
        Dim clonedLGBrush As LinearGradientBrush = _
        CType(myLGBrush.Clone(), LinearGradientBrush)
        clonedLGBrush.TranslateTransform(-100.0F, 0.0F)
        y = 150
        e.Graphics.FillEllipse(clonedLGBrush, x, y, w, h)
    End Sub

イベント内のコードを、サブ化したいんです。
例とか、教えてください。
eの渡し方とかsenderも。
pictureBoxの使用数を減らしたいんです。