真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

關(guān)于vb.net拖拽數(shù)據(jù)源的信息

VB.net 實(shí)現(xiàn)TreeView控件的拖拽事件

注意看看控件的屬性,這個(gè)是可以靠修改屬性來更改的,里面有接收拖曳進(jìn)來的數(shù)據(jù)和拖曳出去的數(shù)據(jù)的屬性,改成ture就可以拖曳了csdn中有拖曳的實(shí)例,就是以treeview控件為例子的,去找找,我上次見過,好像在控件那部分

海寧網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),海寧網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為海寧成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的海寧做網(wǎng)站的公司定做!

VB.net怎么實(shí)現(xiàn)控件拖動(dòng)的時(shí)候顯示里面的內(nèi)容?

在控件的MouseDown事件中,記錄控件的當(dāng)前位置和鼠標(biāo)坐標(biāo),并設(shè)置一個(gè)標(biāo)志變量表示進(jìn)入拖動(dòng)狀態(tài);在MouseMove事件中,判斷如果當(dāng)前是拖動(dòng)狀態(tài),則根據(jù)鼠標(biāo)的當(dāng)前坐標(biāo)和MouseDown時(shí)的坐標(biāo)計(jì)算出移動(dòng)量,更改控件位置;在MouseUp事件中清除標(biāo)志變量。

vb.net textbox1選中的文本,拖放到textbox2?

很久沒有上這里了,今天看到了這個(gè)問題,嘗試做了一個(gè);

本例以源文本框TextBox1全部文字作為拖放文字為例,實(shí)現(xiàn)拖放

1、向一個(gè)窗體中添加兩個(gè)文本框,分別名為TextBox1,TextBox2。注意:把TextBox2控件的AllowDrop屬性設(shè)置成True,這點(diǎn)不要遺漏。

2、完整的代碼如下:

Public Class Form1

Private MouseIsDown As Boolean = False

Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown

'設(shè)置一個(gè)標(biāo)志以顯示鼠標(biāo)已按下。

MouseIsDown = True

End Sub

Private Sub TextBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove

If MouseIsDown Then

'開始拖動(dòng)(將TextBox1的文本內(nèi)容作為拖放內(nèi)容)。

TextBox1.DoDragDrop(TextBox1.Text, DragDropEffects.Copy)

End If

MouseIsDown = False

End Sub

Private Sub TextBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragEnter

'檢查正在被拖放的數(shù)據(jù)的格式。

If (e.Data.GetDataPresent(DataFormats.Text)) Then

'顯示復(fù)制光標(biāo)(表示是拖放行為)。

e.Effect = DragDropEffects.Copy

Else

'顯示不放置光標(biāo)(表示不是拖放行為)。

e.Effect = DragDropEffects.None

End If

End Sub

Private Sub TextBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox2.DragDrop

'粘貼文本(將拖放內(nèi)容作為TextBox2的文本內(nèi)容)。

TextBox2.Text = e.Data.GetData(DataFormats.Text)

End Sub

End Class

vb.net 如何實(shí)現(xiàn)拖拽

打一個(gè)AjaxControlToolkit補(bǔ)丁包

里面有很多控件

就有你想要的拖拽控件

VB.NET拖放文本文件到TextBox獲得其路徑。

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

TextBox1.AllowDrop = True

End Sub

Private Sub TextBoxDragEnter(sender As Object, e As DragEventArgs) Handles TextBox1.DragEnter

If e.Data.GetDataPresent(DataFormats.FileDrop) Then

Dim files As String()

Try

files = CType(e.Data.GetData(DataFormats.FileDrop), String())

Me.TextBox1.Text = files(files.Length - 1)

Catch ex As Exception

MessageBox.Show(ex.Message)

Return

End Try

End If

End Sub

TextBox1.AllowDrop = True 是開啟拖放支持,可以在窗體設(shè)計(jì)器里面開啟它,也可以代碼開啟。

VB.NET的ListBox怎樣實(shí)現(xiàn)項(xiàng)目可以拖動(dòng)

追問: 額,沒有學(xué)過C# 回答: 一樣的 Imports System.Drawing Imports System.Collections Imports System.ComponentModel Imports System.Windows.Forms Imports System.Data Namespace WindowsApplication2 Public Class Form1 Inherits System.Windows.Forms.Form Private listBox1 As System.Windows.Forms.ListBox Private indexofsource As Integer '拖動(dòng)的起始索引 Private indexoftarget As Integer '拖動(dòng)的結(jié)束索引 Private components As System.ComponentModel.Container = Nothing Public Sub New() InitializeComponent() End Sub Protected Overrides Sub Dispose(disposing As Boolean) If disposing Then If components IsNot Nothing Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Private Sub InitializeComponent() Me.listBox1 = New System.Windows.Forms.ListBox() Me.SuspendLayout() ' ' listBox1 ' Me.listBox1.AllowDrop = True '這個(gè)屬性一定要設(shè)置為true; Me.listBox1.ItemHeight = 12 Me.listBox1.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", _ "7", "8", "9", "0"}) Me.listBox1.Location = New System.Drawing.Point(16, 8) Me.listBox1.Name = "listBox1" Me.listBox1.ScrollAlwaysVisible = True Me.listBox1.Size = New System.Drawing.Size(264, 136) Me.listBox1.TabIndex = 0 AddHandler Me.listBox1.MouseDown, New System.Windows.Forms.MouseEventHandler(AddressOf Me.listBox1_MouseDown) AddHandler Me.listBox1.DragOver, New System.Windows.Forms.DragEventHandler(AddressOf Me.listBox1_DragOver) AddHandler Me.listBox1.DragDrop, New System.Windows.Forms.DragEventHandler(AddressOf Me.listBox1_DragDrop) Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(292, 273) Me.Controls.Add(Me.listBox1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) End Sub STAThread _ Private Shared Sub Main() Application.Run(New Form1()) End Sub Private Sub listBox1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) indexofsource = DirectCast(sender, ListBox).IndexFromPoint(e.X, e.Y) If indexofsource ListBox.NoMatches Then DirectCast(sender, ListBox).DoDragDrop(DirectCast(sender, ListBox).Items(indexofsource).ToString(), DragDropEffects.All) End If End Sub Private Sub listBox1_DragOver(sender As Object, e As System.Windows.Forms.DragEventArgs) '拖動(dòng)源和放置的目的地一定是一個(gè)ListBox If e.Data.GetDataPresent(GetType(System.String)) AndAlso DirectCast(sender, ListBox).Equals(listBox1) Then e.Effect = DragDropEffects.Move Else e.Effect = DragDropEffects.None End If End Sub Private Sub listBox1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Dim listbox__1 As ListBox = DirectCast(sender, ListBox) indexoftarget = listbox__1.IndexFromPoint(listbox__1.PointToClient(New Point(e.X, e.Y))) If indexoftarget ListBox.NoMatches Then Dim temp As String = listbox__1.Items(indexoftarget).ToString() listbox__1.Items(indexoftarget) = listbox__1.Items(indexofsource) listbox__1.Items(indexofsource) = temp listbox__1.SelectedIndex = indexoftarget End If End Sub End Class End Namespace


文章標(biāo)題:關(guān)于vb.net拖拽數(shù)據(jù)源的信息
網(wǎng)站鏈接:http://weahome.cn/article/hhoepd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部