Imports System.Drawing Imports System.Windows.Forms Public Class Form1 Public k As String Public x As Long Public y As Long Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown 'フォーム上の座標でマウスポインタの位置を取得する '画面座標でマウスポインタの位置を取得する Dim sp As System.Drawing.Point = System.Windows.Forms.Cursor.Position '画面座標をクライアント座標に変換する Dim cp As System.Drawing.Point = Me.PointToClient(sp) 'X座標を取得する Dim x As Integer = cp.X 'Y座標を取得する Dim y As Integer = cp.Y 'https://dobon.net/vb/dotnet/system/cursorposition.html If e.Button = MouseButtons.Left Then MsgBox(k & "クリックしました!(" & x & "," & y & ")") ' Me.CreateGraphics.Clear(Me.BackColor) Me.CreateGraphics.FillEllipse(Brushes.Red, x - 5, y - 5, 10, 10) 'http://hanatyan.sakura.ne.jp/dotnet/zu05.htm Else If e.Button = MouseButtons.Right Then MsgBox(k & "右クリックしました!(" & x & "," & y & ")") ' Me.CreateGraphics.Clear(Me.BackColor) Me.CreateGraphics.FillEllipse(Brushes.Red, x - 5, y - 5, 10, 10) 'http://hanatyan.sakura.ne.jp/dotnet/zu05.htm End If End If 'https://dobon.net/vb/bbs/log3-46/27779.html End Sub Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown k = e.KeyCode MsgBox(e.KeyCode) 'http://rucio.o.oo7.jp/main/dotnet/shokyu/standard21.htm End Sub Private Sub Form1_Keyup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp k = "" End Sub Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click Dim g As Graphics = Me.CreateGraphics Dim fnt As New Font("IPAmj明朝", 180) '文字列を位置(0,0)、青色で表示 g.DrawString(ChrW(&HD867) & ChrW(&HDE3D) & ChrW(&HDB40) & ChrW(&HDD03), fnt, Brushes.Blue, 0, 0) 'リソースを解放する fnt.Dispose() g.Dispose() 'http://pckowaza.web.fc2.com/html/vbdotnet_graphics_drawstringtoform_basic.html 'http://bbs.wankuma.com/index.cgi?mode=al2&namber=67412&KLOG=114 'http://dobon.net/vb/dotnet/graphics/drawstring.html 'http://hanatyan.sakura.ne.jp/dotnet/zu05.htm End Sub End Class