精华内容
下载资源
问答
  • VB使用滚动条实现图形的缩放,对图片进行自动控制!
  • VB 制作的滚动条,方便实用。具体请下载查看,效果非常好
  • 内容索引:VB源码,界面编程,卷轴,滚动条 设置ListBox水平卷动轴的宽度,其实就是设置滚动条的宽度,在输入框中输入数值,点确认后水平滚动条就出现了。
  • VB自制作漂亮的窗体滚动条及控件,可为滚动条增加背景图片,学会了这种方法,你就可以美化你的应用程序窗口中的滚动条,本例中的方法简单,新手也可轻松学会。本控件核心文件为ctlScrollbar.ctl,是一个ctl控件,...
  • VB为ListBox 增加水平的滚动条,这是一个滚动条类的应用,可实现的功能和演示功能为:改变窗体宽度使得滚动条消失、加载ListBox、改变最后一项的标题、增加item、删除最后一个item、items数量统计。
  • VB窗体滚动条风格设计器 VB源代码,它将整个滚动条分解为立体型,边框和主体均可以设置颜色和线条,设置完成就自动生成CSS代码,直接复制到你的网页中就生效了。
  • 内容索引:VB源码,界面编程,滑块,滚动条,字体 VB使用拖动条改变字体大小,用鼠标拖动滑块,窗口内的文字会跟着变大变小,很实用的一个例子,希望对大家有帮助。
  • 摘要:VB源码,其它类别,时钟,滚动条 VB时钟+VB滚动条+字体,里面包括了VB的时钟、text、滚动条等控件的用法和实例源代码,学习学习如何适时预览的字体设置程序,可适时设置字体的大孝字号、垂直和水平宽度。
  • 网络收藏的VB6.0专用的窗体滚动条控件源代码,用于在VB中实现各种颜色的有立体感的的滚动条,有的是平面化的滚动条,根据你的喜好选择对应的滚动条,让软件项目窗体更漂亮,有些滚动条带数值显示功能,改变拖动条的...
  • VB自绘滚动条控件(COX)

    2021-12-12 12:37:29
    V友们都知道VB自带有两个滚动条控件:HScrollBar和VScrollBar,但今天我们来自己"画"一个功能类似的滚动条COX,以以上原理图为目的,用户设置滚动条最大值和最小值以及滚动值,来回拖动滑块按钮改变滚动值,输出滚动...

    如图:
    在这里插入图片描述
    通俗原理:
    在这里插入图片描述
    V友们都知道VB自带有两个滚动条控件:HScrollBar和VScrollBar,但今天我们来自己"画"一个功能类似的滚动条COX,以以上原理图为目的,用户设置滚动条最大值和最小值以及滚动值,来回拖动滑块按钮改变滚动值,输出滚动值。控件样式为横向模式,废话少说,直接开干……
    启动VB6.0主程序,“添加用户控件"添加一个COX控件,切换到代码编辑区。
    '一、添加必要的API函数:
    Option Explicit
    '创建一个圆角矩形,该矩形由X1,Y1-X2,Y2确定,并由X3,Y3确定的椭圆描述圆角弧度
    Private Declare Function CreateRoundRectRgn Lib “gdi32” (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
    '改变窗口的区域
    Private Declare Function SetWindowRgn Lib “user32” (ByVal Hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    '用当前选定的画笔画一个圆角矩形,并用当前选定的刷子在其中填充。X3和Y3定义了用于生成圆角的椭圆
    Private Declare Function RoundRect Lib “gdi32” (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
    '显示文本
    Private Declare Function DrawText Lib “user32” Alias “DrawTextA” (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
    '用这个函数删除GDI对象,比如画笔、刷子、字体、位图、区域以及调色板等等。对象使用的所有系统资源都会被释放
    Private Declare Function DeleteObject Lib “gdi32” (ByVal hObject As Long) As Long
    '滑块按钮和文本的位置
    Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
    End Type
    Private Const DT_CENTER = &H1 '文本垂直居中
    Private Const DT_VCENTER = &H4 '指示文本对齐格式化矩形的中部
    Private Const DT_SINGLELINE = &H20 '只画单行
    '用于鼠标移入移出控件范围的API
    '获取鼠标指针的当前位置
    Private Declare Function GetCursorpos Lib “user32” Alias “GetCursorPos” (lpPoint As POINTAPI) As Long
    '获得整个窗口的范围矩形,窗口的边框、标题栏、滚动条及菜单等都在这个矩形内
    Private Declare Function GetWindowRect Lib “user32” (ByVal Hwnd As Long, lpRect As RECT) As Long
    '判断函数调用时指定虚拟键的状态
    Private Declare Function GetAsyncKeyState Lib “user32” (ByVal vKey As Long) As Integer
    '鼠标位置
    Private Type POINTAPI
    x As Long
    y As Long
    End Type
    '---------------------------------------------------------------------------------------------------------------------------------------
    '二、添加其他变量及控件事件
    Dim WithEvents TimCom1 As Timer '定义判断鼠标事件的计时器
    Dim SliderObject As RECT '定义滑块及文本的位置变量
    Private Const SR_WIDTH As Long = 30 '滑块的宽度
    Dim SR_Min As Double, SR_Max As Double, SR_Value As Double '最小值,最大值,滑动的值
    Dim comColor(2) As Long '按钮边框线、背景、字体颜色
    Dim Aix As Boolean '鼠标在滑块按钮的颜色切换"通行卡”
    Dim Bcolor(9) As Long '滑块边框线和背景颜色(0-1弹起边框线和背景颜色,2-3鼠标经过时边框线和背景颜色,4-5鼠标按下时边框线和背景颜色,6-7控件无效的边框线和背景颜色)
    Dim Fcolor(3) As Long '字体颜色(0弹起颜色,1鼠标经过颜色,2鼠标按下颜色,3无效颜色)
    Public Event Scroll() '控件输出值事件
    '----------------------------------------------------------------------------------------------------------------------------------------
    '三、初始化控件及变量参数
    Private Sub UserControl_Initialize()
    UserControl.AutoRedraw = True: UserControl.ScaleMode = vbPixels
    Set TimCom1 = UserControl.Controls.Add(“VB.Timer”, “TimCom1”)
    TimCom1.Interval = 1: TimCom1.Enabled = False
    Max = 32767
    Min = 0
    Value = 0
    Bcolor(0) = RGB(0, 0, 0): Bcolor(1) = RGB(83, 83, 83): Bcolor(2) = RGB(120, 120, 120): Bcolor(3) = RGB(150, 150, 150): Bcolor(4) = RGB(0, 0, 0): Bcolor(5) = RGB(50, 50, 50): Bcolor(6) = RGB(168, 168, 168): Bcolor(7) = RGB(240, 240, 240)
    Bcolor(8) = RGB(125, 125, 125): Bcolor(9) = RGB(222, 222, 222): Fcolor(0) = vbWhite: Fcolor(1) = vbYellow: Fcolor(2) = RGB(255, 100, 0): Fcolor(3) = RGB(100, 100, 100)
    Call MoveVilss(Value)
    End Sub

    Private Sub UserControl_Resize()
    If UserControl.Width < (SR_WIDTH * 15) * 2 Then UserControl.Width = (SR_WIDTH * 15) * 2
    If UserControl.Height < 255 Then UserControl.Height = 255
    Call RoundedCorners
    comColor(0) = Bcolor(0): comColor(1) = Bcolor(1): comColor(2) = Fcolor(0)
    Call MoveVilss(Value)
    End Sub

    '控件圆角样式
    Private Sub RoundedCorners()
    Dim hRgn(2) As Long
    hRgn(0) = CreateRoundRectRgn(0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight, 3, 3)
    hRgn(1) = SetWindowRgn(UserControl.Hwnd, hRgn(0), True)
    For hRgn(2) = 0 To 1
    Call DeleteObject(hRgn(hRgn(2)))
    Next
    End Sub
    '----------------------------------------------------------------------------------------------------------------------------------------
    '四、编写三个核心函数
    '1、用户设置 value 的值(输入)
    Private Function MoveVilss(ByVal Vworth As Double)
    Dim sldScale As Single, SliderObject As RECT, SldPos(1) As Single
    If Vworth > Max Then Vworth = SR_Max: Value = SR_Max
    sldScale = (UserControl.ScaleWidth - SR_WIDTH) / (SR_Max - SR_Min)
    Call SliderPosition(CInt((Vworth - SR_Min) * sldScale))
    End Function
    '2、滑块按钮改变滚动值(输出)
    Private Sub SlidingBlock(ByVal x As Single)
    Dim SldPos(1) As Single
    Dim sldScale As Double
    SldPos(0) = x - SR_WIDTH / 2
    SldPos(1) = IIf(x < SR_WIDTH / 2, 0, IIf(x > UserControl.ScaleWidth - SR_WIDTH / 2, UserControl.ScaleWidth - SR_WIDTH, SldPos(0)))
    sldScale = (UserControl.ScaleWidth - SR_WIDTH) / (SR_Max - SR_Min)
    On Error GoTo Nx
    SR_Value = CInt(SldPos(1) / sldScale)
    Nx:
    Call SliderPosition(SldPos(0))
    End Sub
    '3、显示滑块和百分比
    Private Sub SliderPosition(ByVal Vprice As Double)
    Dim SldPos(1) As Single, Rectangle(1) As Long
    SliderObject.Left = IIf(Vprice < 1, 1, IIf(Vprice + SR_WIDTH >= UserControl.ScaleWidth, UserControl.ScaleWidth - SR_WIDTH - 2, Vprice))
    SliderObject.Top = 2
    SliderObject.Right = SliderObject.Left + SR_WIDTH
    SliderObject.Bottom = UserControl.ScaleHeight - 2
    UserControl.Refresh
    UserControl.Cls
    UserControl.BackColor = Bcolor(9)
    UserControl.FillStyle = 0
    UserControl.ForeColor = comColor(0)
    UserControl.FillColor = comColor(1)
    Rectangle(0) = RoundRect(UserControl.hdc, SliderObject.Left, SliderObject.Top, SliderObject.Right, SliderObject.Bottom, 3, 3)
    UserControl.ForeColor = comColor(2)
    DrawText UserControl.hdc, CInt(SR_Value / SR_Max * 100) & “%”, -1, SliderObject, DT_CENTER Or DT_VCENTER Or DT_SINGLELINE
    UserControl.FillStyle = 1
    UserControl.ForeColor = Bcolor(8)
    Rectangle(1) = RoundRect(UserControl.hdc, 0, 0, UserControl.ScaleWidth - 1, UserControl.ScaleHeight - 1, 3, 3)
    DeleteObject Rectangle(0): DeleteObject Rectangle(1)
    RaiseEvent Scroll
    End Sub
    '----------------------------------------------------------------------------------------------------------------------------------------
    '五、处理鼠标事件
    Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button <> 1 Then Exit Sub
    comColor(0) = Bcolor(4): comColor(1) = Bcolor(5): comColor(2) = Fcolor(2)
    Call SlidingBlock(x)
    Aix = True
    End Sub

    Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If x > SliderObject.Left And x < SliderObject.Right And y > SliderObject.Top And y < SliderObject.Bottom Then
    TimCom1.Enabled = True
    If Aix <> True Then comColor(0) = Bcolor(2): comColor(1) = Bcolor(3): comColor(2) = Fcolor(1): Call MoveVilss(Value)
    Else
    If Aix <> True Then comColor(0) = Bcolor(0): comColor(1) = Bcolor(1): comColor(2) = Fcolor(0): Call MoveVilss(Value)
    End If
    If Button = 1 Then
    comColor(0) = Bcolor(4): comColor(1) = Bcolor(5): comColor(2) = Fcolor(2)
    Call SlidingBlock(x)
    End If
    End Sub

    Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    comColor(0) = Bcolor(0): comColor(1) = Bcolor(1): comColor(2) = Fcolor(0)
    Call MoveVilss(Value)
    Aix = False
    End Sub
    '----------------------------------------------------------------------------------------------------------------------------------------
    '六、处理鼠标移出控件范围的事件
    Private Sub TimCom1_Timer()
    Dim rt As RECT, Point As POINTAPI
    GetCursorpos Point
    GetWindowRect UserControl.Hwnd, rt
    If Point.x < rt.Left Or Point.x > rt.Right Or Point.y < rt.Top Or Point.y > rt.Bottom Then
    If Aix <> True Then
    comColor(0) = Bcolor(0): comColor(1) = Bcolor(1): comColor(2) = Fcolor(0)
    Call MoveVilss(Value)
    TimCom1.Enabled = False
    End If
    End If
    End Sub
    '----------------------------------------------------------------------------------------------------------------------------------------
    '七、编写控件各个属性
    '最大数值
    Public Property Get Max() As Double
    Max = SR_Max
    End Property

    Public Property Let Max(ByVal vNewValue As Double)
    SR_Max = vNewValue
    PropertyChanged “Max”
    End Property

    '最小数值
    Public Property Get Min() As Double
    Min = SR_Min
    End Property

    Public Property Let Min(ByVal vNewValue As Double)
    SR_Min = vNewValue
    PropertyChanged “Min”
    End Property

    '进度值
    Public Property Get Value() As Double
    Value = SR_Value
    End Property

    Public Property Let Value(ByVal vNewValue As Double)
    SR_Value = vNewValue
    Call MoveVilss(vNewValue)
    PropertyChanged “Value”
    End Property

    '控件边框线及背景颜色
    Public Property Get BackColor1() As OLE_COLOR
    BackColor1 = Bcolor(8)
    End Property

    Public Property Let BackColor1(ByVal vNewValue As OLE_COLOR)
    Bcolor(8) = vNewValue
    Call MoveVilss(Value)
    PropertyChanged “BackColor1”
    End Property

    Public Property Get BackColor2() As OLE_COLOR
    BackColor2 = Bcolor(9)
    End Property

    Public Property Let BackColor2(ByVal vNewValue As OLE_COLOR)
    Bcolor(9) = vNewValue
    Call MoveVilss(Value)
    PropertyChanged “BackColor2”
    End Property

    '滑块按钮边框线颜色
    Public Property Get ButColorA1() As OLE_COLOR
    ButColorA1 = Bcolor(0)
    End Property

    Public Property Let ButColorA1(ByVal vNewValue As OLE_COLOR)
    Bcolor(0) = vNewValue
    comColor(0) = vNewValue
    Call MoveVilss(Value)
    PropertyChanged “ButColorA1”
    End Property

    Public Property Get ButColorA2() As OLE_COLOR
    ButColorA2 = Bcolor(1)
    End Property

    Public Property Let ButColorA2(ByVal vNewValue As OLE_COLOR)
    Bcolor(1) = vNewValue
    comColor(1) = vNewValue
    Call MoveVilss(Value)
    PropertyChanged “ButColorA2”
    End Property

    Public Property Get ButColorB1() As OLE_COLOR
    ButColorB1 = Bcolor(2)
    End Property

    Public Property Let ButColorB1(ByVal vNewValue As OLE_COLOR)
    Bcolor(2) = vNewValue
    PropertyChanged “ButColorB1”
    End Property

    Public Property Get ButColorB2() As OLE_COLOR
    ButColorB2 = Bcolor(3)
    End Property

    Public Property Let ButColorB2(ByVal vNewValue As OLE_COLOR)
    Bcolor(3) = vNewValue
    PropertyChanged “ButColorB2”
    End Property

    Public Property Get ButColorC1() As OLE_COLOR
    ButColorC1 = Bcolor(4)
    End Property

    Public Property Let ButColorC1(ByVal vNewValue As OLE_COLOR)
    Bcolor(4) = vNewValue
    PropertyChanged “ButColorC1”
    End Property

    Public Property Get ButColorC2() As OLE_COLOR
    ButColorC2 = Bcolor(5)
    End Property

    Public Property Let ButColorC2(ByVal vNewValue As OLE_COLOR)
    Bcolor(5) = vNewValue
    PropertyChanged “ButColorC2”
    End Property

    Public Property Get ButColorD1() As OLE_COLOR
    ButColorD1 = Bcolor(6)
    End Property

    Public Property Let ButColorD1(ByVal vNewValue As OLE_COLOR)
    Bcolor(6) = vNewValue
    PropertyChanged “ButColorD1”
    End Property

    Public Property Get ButColorD2() As OLE_COLOR
    ButColorD2 = Bcolor(7)
    End Property

    Public Property Let ButColorD2(ByVal vNewValue As OLE_COLOR)
    Bcolor(7) = vNewValue
    PropertyChanged “ButColorD2”
    End Property

    '字体颜色
    Public Property Get ForeColor() As OLE_COLOR
    ForeColor = Fcolor(0)
    End Property

    Public Property Let ForeColor(ByVal vNewValue As OLE_COLOR)
    Fcolor(0) = vNewValue
    comColor(2) = vNewValue
    Call MoveVilss(Value)
    PropertyChanged “ForeColor”
    End Property

    Public Property Get ForeColor1() As OLE_COLOR
    ForeColor1 = Fcolor(1)
    End Property

    Public Property Let ForeColor1(ByVal vNewValue As OLE_COLOR)
    Fcolor(1) = vNewValue
    PropertyChanged “ForeColor1”
    End Property

    Public Property Get ForeColor2() As OLE_COLOR
    ForeColor2 = Fcolor(2)
    End Property

    Public Property Let ForeColor2(ByVal vNewValue As OLE_COLOR)
    Fcolor(2) = vNewValue
    PropertyChanged “ForeColor2”
    End Property

    Public Property Get ForeColor3() As OLE_COLOR
    ForeColor3 = Fcolor(3)
    End Property

    Public Property Let ForeColor3(ByVal vNewValue As OLE_COLOR)
    Fcolor(3) = vNewValue
    PropertyChanged “ForeColor3”
    End Property
    '----------------------------------------------------------------------------------------------------------------------------------------
    '八、读写各个属性值
    '储存属性参数值到内存
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    '- - - 按钮背景颜色 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Call PropBag.WriteProperty(“Max”, SR_Max, 32767)
    Call PropBag.WriteProperty(“Min”, SR_Min, 0)
    Call PropBag.WriteProperty(“Value”, SR_Value, 0)
    Call PropBag.WriteProperty(“BackColor2”, UserControl.BackColor, RGB(255, 255, 255))
    Call PropBag.WriteProperty(“ButColorA1”, Bcolor(0), RGB(0, 0, 0))
    Call PropBag.WriteProperty(“ButColorA2”, Bcolor(1), RGB(83, 83, 83))
    Call PropBag.WriteProperty(“ButColorB1”, Bcolor(2), RGB(120, 120, 120))
    Call PropBag.WriteProperty(“ButColorB2”, Bcolor(3), RGB(150, 150, 150))
    Call PropBag.WriteProperty(“ButColorC1”, Bcolor(4), RGB(0, 0, 0))
    Call PropBag.WriteProperty(“ButColorC2”, Bcolor(5), RGB(50, 50, 50))
    Call PropBag.WriteProperty(“ButColorD1”, Bcolor(6), RGB(168, 168, 168))
    Call PropBag.WriteProperty(“ButColorD2”, Bcolor(7), RGB(240, 240, 240))
    Call PropBag.WriteProperty(“BackColor1”, Bcolor(8), RGB(125, 125, 125))
    Call PropBag.WriteProperty(“BackColor2”, Bcolor(9), RGB(222, 222, 222))
    '- - - 按钮字体颜色 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Call PropBag.WriteProperty(“ForeColor”, Fcolor(0), vbWhite)
    Call PropBag.WriteProperty(“ForeColor1”, Fcolor(1), vbYellow)
    Call PropBag.WriteProperty(“ForeColor2”, Fcolor(2), RGB(100, 255, 0))
    Call PropBag.WriteProperty(“ForeColor3”, Fcolor(3), RGB(100, 100, 100))
    End Sub

    '从内存里读取属性设置值
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    '- - - 按钮背景颜色 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SR_Max = PropBag.ReadProperty(“Max”, 32767)
    SR_Min = PropBag.ReadProperty(“Min”, 0)
    SR_Value = PropBag.ReadProperty(“Value”, 0)
    UserControl.BackColor = PropBag.ReadProperty(“BackColor2”, RGB(255, 255, 255))
    Bcolor(0) = PropBag.ReadProperty(“ButColorA1”, RGB(0, 0, 0))
    Bcolor(1) = PropBag.ReadProperty(“ButColorA2”, RGB(83, 83, 83))
    Bcolor(2) = PropBag.ReadProperty(“ButColorB1”, RGB(120, 120, 120))
    Bcolor(3) = PropBag.ReadProperty(“ButColorB2”, RGB(150, 150, 150))
    Bcolor(4) = PropBag.ReadProperty(“ButColorC1”, RGB(0, 0, 0))
    Bcolor(5) = PropBag.ReadProperty(“ButColorC2”, RGB(50, 50, 50))
    Bcolor(6) = PropBag.ReadProperty(“ButColorD1”, RGB(168, 168, 168))
    Bcolor(7) = PropBag.ReadProperty(“ButColorD2”, RGB(240, 240, 240))
    Bcolor(8) = PropBag.ReadProperty(“BackColor1”, RGB(125, 125, 125))
    Bcolor(9) = PropBag.ReadProperty(“BackColor2”, RGB(222, 222, 222))
    '- - - 按钮字体颜色 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Fcolor(0) = PropBag.ReadProperty(“ForeColor”, vbWhite)
    Fcolor(1) = PropBag.ReadProperty(“ForeColor1”, vbYellow)
    Fcolor(2) = PropBag.ReadProperty(“ForeColor2”, RGB(255, 100, 0))
    Fcolor(3) = PropBag.ReadProperty(“ForeColor3”, RGB(100, 100, 100))
    comColor(0) = Bcolor(0): comColor(1) = Bcolor(1): comColor(2) = Fcolor(0): Call MoveVilss(Value)
    End Sub
    '----------------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------------
    '到此一个简易的滚动条COX控件就完成了,至于控件界面美化或更多功能自己改动和研究啦,嘿嘿~~
    '转载请标明出处:https://blog.csdn.net/ty5858?spm=1010.2135.3001.5421

    展开全文
  • 更改滚动条背景色,此代码来自别人,非本人所写,本人看后觉得不错,发上来贡献下,小拿点下载分。
  • VB 给窗体添加滚动条

    热门讨论 2010-06-07 13:14:33
    VB 给窗体添加滚动条 VB 给窗体添加滚动条
  • VB 垂直滚动条 max

    2008-11-05 16:27:57
    仿max系统的垂直滚动条 很好看 附有源码
  • VB 滚轮控制滚动条

    2012-09-21 14:58:05
    滚轮可以控制滚动条,但是老是闪,不知道 怎么解决
  • VB自定义ListBox滚动条颜色和背景色,就是在默认风格的基础上,对ListBox的列表框、滚动条以及背景色进行重新定义,渐变色之类的。最终定义的效果会使其数据显示结构更清淅、内容更易读,如演示截图所示。
  • 运用vb语言编写程序代码,使用滚动条来改变颜色
  • VB6 给窗体添加滚动条,调整水平滚动条的一些属性。当窗体的大小发生变化时发生,垂直滚动条与窗体相对位置不变,滚动条的大小随着窗体大小的改变而改变,命令按钮作水平滚动条与垂直滚动条交接处的填充。  因代码...
  • 内容索引:VB源码,报表打印,ListBox,滚动条 VB在ListBox列表上增加一个水平滚动条的功能,这样更方便于用户的操作,大家都知道,原有的listbox控件一般都没有自带这种功能,这样将ListBox里的文字比较多时,就会被...
  • 内容索引:VB源码,界面编程,调色器,滚动条 一款基于VB的颜色滚动条,拖动变色,实际是本示例是属于界面编程的范畴,主要演示拖动条如何使用,代码比较初级,对刚学习VB的朋友有一定帮助。
  • VB怎么让文本框滚动条滚动text自带的那个滚动条,我要的是写代码让滚动条移动的...给个思路就好~~VB中让文本框滚动条滚动,首先要设置文本框的属性值Mutiline属性为true;其次,设置文本框的Scrollbars的属性为...

    VB怎么让文本框滚动条滚动

    text自带的那个滚动条,我要的是写代码让滚动条移动的...给个思路就好~~

    VB中让文本框滚动条滚动,首先要设置文本框的属性值Mutiline属性为true;

    ab23608bbafbc68819248b155ac400aa.png

    其次,设置文本框的Scrollbars的属性为Vertical(表示垂直滚动条)或者Horizontal(表示水平滚动条);

    将文本框赋值后,当文本框的内容大于当前文本框显示内容

    vb里面怎么设置textbox的滚动条?

    vb6.0中text中滚动条的用法

    我建立了一个文本框,每点击一次按钮都会换行增加显示一个数据。 我想要MultiLine 属性多行 ScrollBars 属性 返回或设置一个值,该值指示一个对象是有水平滚动条还是有垂直滚动条。在运行时是只读的。 语法 object.ScrollBars object 所在处代表一个对象表达式,其值是“应用于”列表中的一个对象。

    vb文本框,如何设置才能达到内容超出文本框时才显如题,如果文本框里的内容不超出文本框的高和宽,则让文本框不显示滚动楼上说得麻烦了,在text文本框的属性把,multiline属性设置为True。

    vb里面添加文本框,让文本框可以多行显示,满了换'Text1.MultiLine = True 允许多行 'Text1.ScrollBars = 2 竖着的滚动条 Text1.SelStart = Len(Text1.Text) 定位光标到最后

    VB中怎样同时显示textBox的水平和垂直滚动条

    VB文本框同时显示水平和垂直滚动条步骤: 设置TextBox控件的MultiLine 属性为True。 设置TextBox控件的ScrollBars 属性为VbBoth。 ScrollBars 属性,返回或设置一个值,该值指示一个对象是有水平滚动条还是有垂直滚动条。在运行时是只读的。

    如何使用VB在文本框内显示滚动条滚动到的数值

    '返回第一个可见行的编号 rc = SendMessage(Text1.hwnd, EM_GETFIRSTVISIBLELINE, 0, 0) MsgBox rc

    VB中如何用文本框控制滚动条中的数值?

    Private Sub Text1_Change() HScroll1.Value = Val(Text1.Text) End Sub

    VB 文本框中滚动条怎么使文本框中的文本跟着水平滚动条和垂直滚动条左右、上下移动。

    你的意思是不使用文本框只带的滚动条,要另外添加滚动条来控制文本的滚动。

    在vb中,如何编程能使文本框中实时显示滚动条的位置

    在滚动条的change事件中加上一句text1.tex=滚动条.val

    展开全文
  • 内容索引:VB源码,界面编程,滚动条 VB窗体滚动条控件,简单写一应用实例附上源代码,从截图就可以看出,是不是有点个性?上侧的滚动条是不能拖动的,可以作为指示用,类似进度条的功能,拖动下边的滚动条,上边的会...
  • 运用vb编程,用来改变字体的大小,包含源代码。有利于初学者的学习
  • vb鼠标滚动条

    2013-02-24 12:20:46
    1、打开文件,生成dll文件。直接保存 2、在vb程序中 外接程序->外接程序管理器,选择添加
  • 主讲老师:郭盛华 什么是滚动条: ...使用滚动条控件可以浏览比较大的图片、文本等内容,这样以节省窗体空间。 Private Sub HScroll1_Change() Label1.Caption = "滚动条值为:" & HScrol...

    主讲老师:郭盛华

     

    什么是滚动条:

     

    滚动条控件具有水平滚动条控件(HScrollBar)和垂直滚动条控件(VScrollBar),他们除了方向不同外,其它没有什么区别。使用滚动条控件可以浏览比较大的图片、文本等内容,这样以节省窗体空间。
     
    Private Sub HScroll1_Change()
    Label1.Caption = "滚动条值为:" & HScroll1.Value
    End Sub
    
    
     
     
    具体请看视频教程:微博@郭盛华老师
     
    展开全文
  • vb6 ListBox横向滚动条

    千次阅读 2018-01-24 15:31:57
     "横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范" & _  "横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范"  Next Information    ...
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
    
       (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
       (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function SetWindowPos Lib "user32" _
       (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
        ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
        ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Long, ByVal wMsg As Long, _
        ByVal wParam As Long, ByVal lParam As Long) As Long
         'api声明
        
    Private Const GWL_STYLE = (-16)
    Private Const SWP_NOACTIVATE = &H10
    Private Const SWP_NOCOPYBITS = &H100
    Private Const SWP_NOMOVE = &H2
    Private Const SWP_NOOWNERZORDER = &H200
    Private Const SWP_NOREDRAW = &H8
    Private Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOZORDER = &H4
    Private Const SWP_SHOWWINDOW = &H40
    Private Const SWP_FRAMECHANGED = &H20
    Private Const WS_HSCROLL = &H100000
    Private Const LB_SETHORIZONTALEXTENT = &H194
    Private Const LB_GETHORIZONTALEXTENT = &H193
          '常量声明


    Private Sub Form_Load()
    Dim Information#, Scrollbar#

       For Information = 1 To 88
          List1.AddItem _
             "横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范" & _
             "横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范" & _
             "横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范横滚动条示范"
       Next Information
       
       Information = SendMessageLong(List1.hwnd, LB_SETHORIZONTALEXTENT, 2000, 0)
                                                                        '2000:控制横滚动条的范围(建议值2000-3000)
       Scrollbar = GetWindowLong(List1.hwnd, GWL_STYLE)
       Scrollbar = Scrollbar Or WS_HSCROLL
       SetWindowLong List1.hwnd, GWL_STYLE, Scrollbar
       SetWindowPos List1.hwnd, _
          0, 0, 0, 0, 0, _
          SWP_NOMOVE Or SWP_NOOWNERZORDER Or SWP_NOSIZE Or SWP_FRAMECHANGED
       
    End Sub
    展开全文
  • 内容索引:VB源码,界面编程,滚动条,进度条 VB个性滚动条、进度条,个性体现在它可以设置背景图,不依靠系统的滚动条组件,使用简易方便,软件界面个性定制很有帮助,运行截图如上。
  • VB6.0实现滚动条用图片的美化效果,是一个图形化滚动条的专有VB控件,可应用 于众多的VB工程软件中,可美化你的窗体,自定义你的窗口界面,与主界面相融合,当然VB中的滚动条控件有很多了,这一个仅供参考哦。
  • vb.net做的一个滚动字幕的程序,程序的运行效果为滚动的字条,
  • 内容索引:VB源码,其它类别,CSS设计器 VB滚动条CSS样式设计器源程序 v1.0,看上去很专业,从此设计滚动条CSS样式再也不用发愁了,可视化界面,操作非常方便。它将整个滚动条分解为立体型,边框和主体均可以设置...
  • 还挺新颖,一般不怎么这么用,就是当你拖动滚动条的时候,窗体中的内容不论什么,都随着滚动条的移动而滚动,就像在IE中浏览网页一样,实现起来并不麻烦,要想知道是如何实现的,那么就请下载查看源代码吧。

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 7,513
精华内容 3,005
关键字:

vb如何使用滚动条