Salut à tous,
connaissez-vous un moyen pour ne pas afficher le ScrollBar d'un ListBox ?
Merci et à bientôt.
Salut à tous,
connaissez-vous un moyen pour ne pas afficher le ScrollBar d'un ListBox ?
Merci et à bientôt.
Salut à tous,
connaissez-vous un moyen pour ne pas afficher le ScrollBar d'un ListBox ?
Merci et à bientôt.
Salut Boris!
Regarde du côté des propriétés ScrollAlwaysVisible et HorizontalScrollBar du
ListBox
Salut Boris!
Regarde du côté des propriétés ScrollAlwaysVisible et HorizontalScrollBar du
ListBox
Salut Boris!
Regarde du côté des propriétés ScrollAlwaysVisible et HorizontalScrollBar du
ListBox
La propriété ScollAlwaysVisible ne gère pas cela, mais seulement la
possibilité de TOUJOURS afficher la VerticalScrollBar.
Merci pour ton aide.
Boris.
La propriété ScollAlwaysVisible ne gère pas cela, mais seulement la
possibilité de TOUJOURS afficher la VerticalScrollBar.
Merci pour ton aide.
Boris.
La propriété ScollAlwaysVisible ne gère pas cela, mais seulement la
possibilité de TOUJOURS afficher la VerticalScrollBar.
Merci pour ton aide.
Boris.
Salut Boris!
> La propriété ScollAlwaysVisible ne gère pas cela, mais seulement la
> possibilité de TOUJOURS afficher la VerticalScrollBar.
ah! c'est le fun à savoir. désolé pour la réponse.
Pour résourdre ce problème, il faudra se tourner du côté des APIs...
Voici un exemple d'utilisation de la foncton ShowScrollBar() qui fera ce
tu veux :
'***
Option Explicit On
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel
InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste
composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur
Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(32, 16)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.ScrollAlwaysVisible = True
Me.ListBox1.Size = New System.Drawing.Size(160, 160)
Me.ListBox1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(120, 184)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Const SB_HORZ As Int32 = 0
Private Const SB_VERT As Int32 = 1
Private Const SB_CTL As Int32 = 2
Private Const SB_BOTH As Int32 = 3
'BOOL ShowScrollBar(
' HWND hWnd,
' int wBar,
' BOOL(bShow)
<DllImport("user32.dll")> _
Private Shared Function ShowScrollBar _
( _
ByVal hWnd As IntPtr, _
ByVal wBar As Int32, _
ByVal bShow As Boolean) As Boolean
'
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' on cache la scrollbar vertical
ShowScrollBar(ListBox1.Handle, SB_VERT, False)
End Sub
End Class
'***
En cliquant sur le bouton, tu devrais voir la barre vertical disparaitre
la liste...
--
Cordialement
Yanick
MVP pour Visual Basic
>
> Merci pour ton aide.
>
> Boris.
Salut Boris!
> La propriété ScollAlwaysVisible ne gère pas cela, mais seulement la
> possibilité de TOUJOURS afficher la VerticalScrollBar.
ah! c'est le fun à savoir. désolé pour la réponse.
Pour résourdre ce problème, il faudra se tourner du côté des APIs...
Voici un exemple d'utilisation de la foncton ShowScrollBar() qui fera ce
tu veux :
'***
Option Explicit On
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel
InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste
composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur
Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(32, 16)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.ScrollAlwaysVisible = True
Me.ListBox1.Size = New System.Drawing.Size(160, 160)
Me.ListBox1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(120, 184)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Const SB_HORZ As Int32 = 0
Private Const SB_VERT As Int32 = 1
Private Const SB_CTL As Int32 = 2
Private Const SB_BOTH As Int32 = 3
'BOOL ShowScrollBar(
' HWND hWnd,
' int wBar,
' BOOL(bShow)
<DllImport("user32.dll")> _
Private Shared Function ShowScrollBar _
( _
ByVal hWnd As IntPtr, _
ByVal wBar As Int32, _
ByVal bShow As Boolean) As Boolean
'
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' on cache la scrollbar vertical
ShowScrollBar(ListBox1.Handle, SB_VERT, False)
End Sub
End Class
'***
En cliquant sur le bouton, tu devrais voir la barre vertical disparaitre
la liste...
--
Cordialement
Yanick
MVP pour Visual Basic
>
> Merci pour ton aide.
>
> Boris.
Salut Boris!
> La propriété ScollAlwaysVisible ne gère pas cela, mais seulement la
> possibilité de TOUJOURS afficher la VerticalScrollBar.
ah! c'est le fun à savoir. désolé pour la réponse.
Pour résourdre ce problème, il faudra se tourner du côté des APIs...
Voici un exemple d'utilisation de la foncton ShowScrollBar() qui fera ce
tu veux :
'***
Option Explicit On
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel
InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste
composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur
Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(32, 16)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.ScrollAlwaysVisible = True
Me.ListBox1.Size = New System.Drawing.Size(160, 160)
Me.ListBox1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(120, 184)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Const SB_HORZ As Int32 = 0
Private Const SB_VERT As Int32 = 1
Private Const SB_CTL As Int32 = 2
Private Const SB_BOTH As Int32 = 3
'BOOL ShowScrollBar(
' HWND hWnd,
' int wBar,
' BOOL(bShow)
<DllImport("user32.dll")> _
Private Shared Function ShowScrollBar _
( _
ByVal hWnd As IntPtr, _
ByVal wBar As Int32, _
ByVal bShow As Boolean) As Boolean
'
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' on cache la scrollbar vertical
ShowScrollBar(ListBox1.Handle, SB_VERT, False)
End Sub
End Class
'***
En cliquant sur le bouton, tu devrais voir la barre vertical disparaitre
la liste...
--
Cordialement
Yanick
MVP pour Visual Basic
>
> Merci pour ton aide.
>
> Boris.