全3件 (3件中 1-3件目)
1
Public Class Form1 Dim pos As Point Private Sub Button1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then CType(sender, Button).Top = Me.PointToClient(Cursor.Position).Y - pos.Y CType(sender, Button).Left = Me.PointToClient(Cursor.Position).X - pos.X Application.DoEvents() End If End Sub Private Sub Button1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown pos = New Point(e.X, e.Y) Dim btn As Button btn = New Button btn.Top = Button1.Top btn.Left = Button1.Left btn.Parent = Me btn.BringToFront() AddHandler btn.MouseMove, AddressOf Me.Button1_MouseMove btn.Focus() End SubEnd Class
2010.04.15
Public Class Form1 '/角度が増える割合 Dim r_wari As Double = 0.2 Dim r_cnt As Double = 0 '/一個の角度 Dim r1 As Double = Math.PI / 10 '/半径 Dim rad1 As Integer = 90 '/中心 Dim center1 As Integer = 100 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick r_cnt = r_cnt + r_wari Dim x As Double = Math.Cos(r1 * r_cnt) * rad1 + center1 Dim y As Double = Math.Sin(r1 * r_cnt) * rad1 + center1 Me.Button1.Top = y Me.Button1.Left = x x = Math.Cos(r1 * (r_cnt + 2)) * rad1 + center1 y = Math.Sin(r1 * (r_cnt + 2)) * rad1 + center1 Me.Button2.Top = y Me.Button2.Left = x x = Math.Cos(r1 * (r_cnt + 4)) * rad1 + center1 y = Math.Sin(r1 * (r_cnt + 4)) * rad1 + center1 Me.Button3.Top = y Me.Button3.Left = x End Sub Private Sub Label1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter Timer1.Enabled = True End Sub Private Sub Label1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave Timer1.Enabled = False End SubEnd Class
2010.04.12
Dim comm As New System.Data.Odbc.OdbcConnection Dim cb As System.Data.Odbc.OdbcConnectionStringBuilder cb = New System.Data.Odbc.OdbcConnectionStringBuilder() cb.Dsn = "ieda" cb.Add("user id", "postgres") cb.Add("password", "momoco") comm.ConnectionString = cb.ConnectionString comm.Open() Dim da As System.Data.Odbc.OdbcDataAdapter Dim cbld As System.Data.Odbc.OdbcCommandBuilder Dim table1 As New DataTable da = New System.Data.Odbc.OdbcDataAdapter("SELECT * FROM aevent", comm) da.Fill(table1) cbld = New System.Data.Odbc.OdbcCommandBuilder(da) da.InsertCommand = New System.Data.Odbc.OdbcCommand("INSERT INTO aevent (eventname,adddata) VALUES (?,?)") da.InsertCommand.Parameters.Add(New System.Data.Odbc.OdbcParameter("@eventname", Odbc.OdbcType.NText, 12, "eventname")) da.InsertCommand.Parameters.Add(New System.Data.Odbc.OdbcParameter("@adddata", Odbc.OdbcType.NText, 12, "adddata")) Dim datar As DataRow datar = table1.NewRow datar("eventname") = "A" datar("adddata") = "123" table1.Rows.Add(datar) Try da.Update(table1) Catch ex As Exception MessageBox.Show(ex.Message) End Try
2010.04.05
全3件 (3件中 1-3件目)
1
![]()
![]()
![]()