掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
スクロールバーを画像に変えるには? (ID:116710)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
スクロールバーを画像に変えるにはどうすればいいでしょうか? ネットで探しても見つかりません。 簡単に出来る方法を探しています。 ためしに作りましたけど、バーコントロール自体をつまんで移動させる方法 がわかりません。(TT) 環境:VB.NET Sampleは http://www.geocities.jp/dfgkthug/wwwwwwwwww/DOUNRODO.html です。 現在、作成しているソースは '初期定義 Dim kakunin As Integer 'スピード定義 Dim ScrollSpead As Integer 'スクロールバー最後の数字取得定義 Dim ScrollBarSyutoku As Integer 'コントロール定義 Dim contoroll1 As Control Dim contoroll2 As Control Dim contoroll3 As Control Dim contoroll4 As Control Dim contoroll5 As Control Private Sub Scroll_Loding() '横スクロールバーを非表示に設定 ListBox1.HorizontalScrollbar = False 'スクロールバーを常に表示する。 ListBox1.ScrollAlwaysVisible = True 'ラベルの値を設定 '縦のラベル With contoroll1 .Top = ListBox1.Top .Left = ListBox1.Left + ListBox1.Width - 18 .Width = (ListBox1.Left + ListBox1.Width) - (ListBox1.Left + ListBox1.Width - 18) .Height = ListBox1.Height .Text = "" .BackColor = Me.BackColor End With 'バーの設定 '<上矢印> With contoroll2 .Top = ListBox1.Top .Left = contoroll1.Left End With '<下矢印> With contoroll3 .Top = ListBox1.Top + ListBox1.Height - .Height .Left = contoroll1.Left End With '<バーの設定> With contoroll4 .Top = contoroll2.Top + contoroll2.Height .Left = (contoroll2.Width - 4) / 2 + contoroll1.Left '.Left=contoroll1.Left .Width = 4 '.Width=contoroll2.Width .Height = contoroll3.Top - contoroll2.Top - contoroll2.Height .BackColor = Color.Yellow End With '<バーコントロールの設定> With contoroll5 .Top = contoroll2.Top + contoroll2.Height .Left = (contoroll2.Width - .Width) / 2 + contoroll1.Left End With 'タイマーの設定 Timer1.Interval = ScrollSpead End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'SampleのためListBoxにデータを入れます。 Dim i As Integer Dim s As Integer Dim t As String For i = 0 To 100 For s = 1 To 20 t = t & i Next ListBox1.Items.Add(t) t = Nothing Next 'コントロール定義にコントロールを入れる contoroll1 = Label1 '縦のスクロールバーを隠すためのもの contoroll2 = PictureBox1 '上矢印 contoroll3 = PictureBox3 '下矢印 contoroll4 = PictureBox2 'バーの設定 contoroll5 = PictureBox4 'バーコントロール 'スクロールバーが一番下まで移動したときのTopIndexの値 If ListBox1.Items.Count = 0 Then ScrollBarSyutoku = 0 Else ListBox1.SelectedIndex = ListBox1.Items.Count - 1 ScrollBarSyutoku = ListBox1.TopIndex ListBox1.SelectedIndex = 0 End If 'スクロールするスピードの設定 ScrollSpead = 100 Scroll_Loding() End Sub Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown kakunin = 1 Timer1.Start() End Sub Private Sub PictureBox3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseDown kakunin = 2 Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If kakunin = 1 Then ListBox1.TopIndex -= 1 ElseIf kakunin = 2 Then ListBox1.TopIndex += 1 End If With ListBox1 contoroll5.Top = (((contoroll4.Height - contoroll5.Height) / ScrollBarSyutoku) * .TopIndex) + contoroll4.Top End With End Sub Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp Timer1.Stop() End Sub Private Sub PictureBox3_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseUp Timer1.Stop() End Sub ソースが長すぎるので最後に書きました。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.