分享

【VB6】自制旋钮控件

 求知881 2015-11-04


这个是旋钮控件,用于调整数值。
其中旋钮的把手的形状、大小都是可以调整的。你也可以不显示把手。
那个小红点也是可以选择是否显示的。
旋钮的旋转范围也是可以调整的。
此外就是,旋钮的刻度的显示密度也是可调的。
为了保证画风不和Windows界面冲突,绘制旋钮用的颜色都是取自系统颜色(比如按钮表面、按钮暗阴影、按钮亮阴影等颜色)。

[Visual Basic] 纯文本查看 复制代码
001VERSION 5.00
002Begin VB.UserControl Knob
003   ClientHeight    =   2415
004   ClientLeft      =   0
005   ClientTop       =   0
006   ClientWidth     =   2430
007   ScaleHeight     =   161
008   ScaleMode       =   3  'Pixel
009   ScaleWidth      =   162
010   Begin VB.PictureBox picKnob
011      Align           =   1  'Align Top
012      AutoRedraw      =   -1  'True
013      Height          =   1335
014      Left            =   0
015      ScaleHeight     =   85
016      ScaleMode       =   3  'Pixel
017      ScaleWidth      =   158
018      TabIndex        =   0
019      Top             =   0
020      Width           =   2430
021      Begin VB.PictureBox picBase
022         AutoRedraw      =   -1  'True
023         BorderStyle     =   0  'None
024         Height          =   495
025         Left            =   0
026         ScaleHeight     =   33
027         ScaleMode       =   3  'Pixel
028         ScaleWidth      =   33
029         TabIndex        =   1
030         Top             =   0
031         Visible         =   0   'False
032         Width           =   495
033      End
034   End
035End
036Attribute VB_Name = "Knob"
037Attribute VB_GlobalNameSpace = False
038Attribute VB_Creatable = True
039Attribute VB_PredeclaredId = False
040Attribute VB_Exposed = False
041'==============================================================================
042'作者:0xAA55
043'论坛:[url]http://www./[/url]
044'版权所有 (C) 2013-2015 技术宅的结界
045'请保留原作者信息,否则视为侵权。
046'------------------------------------------------------------------------------
047Option Explicit
048 
049Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
050 
051Private Const Knob_PI As Double = 3.14159265358979
052Private m_Rad As Double
053Private m_Max As Long
054Private m_Value As Long
055Private m_Steps As Long
056Private m_MaxAng As Double
057Private m_MinAng As Double
058Private m_MouseDown As Boolean
059Private m_MouseAngle As Double
060Private m_BaseRad As Double
061Private m_HandleRad As Double
062Private m_DrawGrad As Boolean
063Private m_DrawPoint As Boolean
064Private m_DrawRaisedHandle As Boolean
065Private m_RaisedHandleWidth1 As Double
066Private m_RaisedHandleWidth2 As Double
067 
068Event Click()
069Attribute Click.VB_Description = "Triggerd when clicked."
070Attribute Click.VB_UserMemId = -600
071Event DblClick()
072Attribute DblClick.VB_Description = "Triggerd when double clicked."
073Attribute DblClick.VB_UserMemId = -601
074Event Change(ByVal OldValue As Long, ByVal NewValue As Long)
075Attribute Change.VB_Description = "Triggerd when the value was changed."
076Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
077Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
078Attribute MouseMove.VB_UserMemId = -606
079Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
080Attribute MouseUp.VB_UserMemId = -607
081Event KeyDown(KeyCode As Integer, Shift As Integer)
082Attribute KeyDown.VB_UserMemId = -602
083Event KeyPress(KeyAscii As Integer)
084Attribute KeyPress.VB_UserMemId = -603
085Event KeyUp(KeyCode As Integer, Shift As Integer)
086Attribute KeyUp.VB_UserMemId = -604
087 
088'绘制旋钮
089Private Sub DrawKnob()
090DrawBaseCircle '先绘制底座圆圈
091DrawHandle '然后绘制“把手”
092End Sub
093 
094'绘制圆圈底座
095Private Sub DrawBaseCircle()
096If m_Rad <= 0 Then Exit Sub
097 
098'用picBase来存住底座圆圈的图像
099picBase.Cls
100 
101If m_DrawGrad Then
102    '画刻度
103    picBase.DrawWidth = 1
104    Dim Ang As Long
105    For Ang = 0 To m_Steps - 1
106        Dim CA As Double, CX As Double, CY As Double
107        CA = m_MinAng + (m_MaxAng - m_MinAng) * Ang / (m_Steps - 1) + Knob_PI * 0.5 '刻度的角度
108        CX = Cos(CA)
109        CY = Sin(CA)
110        picBase.Line (m_Rad + CX * m_Rad * m_BaseRad, m_Rad + CY * m_Rad * m_BaseRad)-(m_Rad + CX * m_Rad, m_Rad + CY * m_Rad) '画辐射线
111    Next
112End If
113 
114'画底座
115picBase.DrawWidth = 3
116DrawLightedCircle picBase, m_Rad, m_Rad, m_Rad * m_BaseRad - 1, GetSysColor(vb3DHighlight And &HFF&), GetSysColor(vb3DDKShadow And &HFF&)
117picBase.DrawWidth = 2
118DrawLightedCircle picBase, m_Rad, m_Rad, m_Rad * m_BaseRad - 3, GetSysColor(vb3DLight And &HFF&), GetSysColor(vbButtonShadow And &HFF&)
119End Sub
120 
121'绘制带光照处理的圆圈
122Private Sub DrawLightedCircle(Targ As PictureBox, ByVal X As Double, ByVal Y As Double, ByVal Radius As Double, ByVal Color1 As Long, ByVal Color2 As Long)
123Dim Ang As Double
124Dim R1 As Long, G1 As Long, B1 As Long
125Dim R2 As Long, G2 As Long, B2 As Long
126Dim DotVal As Double, XV As Double, YV As Double, RV As Long, GV As Long, BV As Long
127 
128'画笔的开始位置
129Targ.CurrentX = X + Radius
130Targ.CurrentY = Y
131 
132'颜色1
133R1 = Color1 And &HFF
134G1 = (Color1 And &HFF00&) \ &H100
135B1 = (Color1 And &HFF0000) \ &H10000
136 
137'颜色2
138R2 = Color2 And &HFF
139G2 = (Color2 And &HFF00&) \ &H100
140B2 = (Color2 And &HFF0000) \ &H10000
141 
142'以像素为单位画一圈
143For Ang = 0 To Knob_PI * 2 Step 1 / Radius
144    XV = Cos(Ang)
145    YV = Sin(Ang)
146    DotVal = (XV + YV + 1) * 0.5 '与光线方向(1,1)做点乘,然后将[-1,1]变换到[0,1]
147    RV = R1 + (R2 - R1) * DotVal '颜色插值
148    GV = G1 + (G2 - G1) * DotVal
149    BV = B1 + (B2 - B1) * DotVal
150    Targ.Line -(X + XV * Radius, Y + YV * Radius), RGB(RV, GV, BV)
151Next
152End Sub
153 
154Private Sub DrawLighedLine(Targ As PictureBox, ByVal X1 As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 As Double, ByVal Color1 As Long, ByVal Color2 As Long)
155On Error Resume Next
156Dim DirX As Double, DirY As Double, DirL As Double
157DirX = X2 - X1
158DirY = Y2 - Y1
159DirL = Sqr(DirX * DirX + DirY * DirY)
160 
161DirX = DirX / DirL
162DirY = DirY / DirL
163 
164Dim NorX As Double, NorY As Double
165NorX = -DirY
166NorY = DirX
167 
168Dim R1 As Long, G1 As Long, B1 As Long
169Dim R2 As Long, G2 As Long, B2 As Long
170Dim DotVal As Double, RV As Long, GV As Long, BV As Long
171 
172'颜色1
173R1 = Color1 And &HFF
174G1 = (Color1 And &HFF00&) \ &H100
175B1 = (Color1 And &HFF0000) \ &H10000
176 
177'颜色2
178R2 = Color2 And &HFF
179G2 = (Color2 And &HFF00&) \ &H100
180B2 = (Color2 And &HFF0000) \ &H10000
181 
182DotVal = (NorX + NorY + 1) * 0.5 '与光线方向(1,1)做点乘,然后将[-1,1]变换到[0,1]
183RV = R1 + (R2 - R1) * DotVal '颜色插值
184GV = G1 + (G2 - G1) * DotVal
185BV = B1 + (B2 - B1) * DotVal
186 
187Targ.DrawWidth = 2
188Targ.Line (X1, Y1)-(X2, Y2), RGB(RV, GV, BV)
189End Sub
190 
191'画“把手”
192Private Sub DrawHandle()
193If m_Rad <= 0 Then Exit Sub
194 
195Dim Ang As Double
196Ang = ValueToAngle(m_Value, m_Max) '旋钮的角度
197 
198'先把画好的底座盖上去
199picKnob.PaintPicture picBase.Image, 0, 0
200 
201'画凸起的把手
202If m_DrawRaisedHandle Then DrawRHandle
203 
204'画小圆点
205If m_DrawPoint Then
206    picKnob.DrawWidth = 1
207    If m_MouseDown Then '鼠标按下的时候,填充颜色
208        picKnob.FillStyle = vbSolid
209        picKnob.FillColor = vbHighlight
210    Else
211        picKnob.FillStyle = 1
212    End If
213    picKnob.Circle (m_Rad + Cos(Ang) * m_Rad * m_BaseRad * 0.5, m_Rad + Sin(Ang) * m_Rad * m_BaseRad * 0.5), 2, vbRed
214End If
215End Sub
216 
217'画凸起的把手
218Private Sub DrawRHandle()
219picKnob.DrawWidth = 2
220 
221Dim Ang As Double
222Ang = ValueToAngle(m_Value, m_Max) '旋钮的角度
223 
224Dim BaseRad As Double
225BaseRad = m_Rad * m_BaseRad * m_HandleRad
226 
227'正向
228Dim DirX As Double, DirY As Double
229DirX = Cos(Ang)
230DirY = Sin(Ang)
231 
232'侧向
233Dim SideX As Double, SideY As Double
234SideX = -DirY
235SideY = DirX
236 
237Dim RHW1 As Double, RHW2 As Double
238RHW1 = m_RaisedHandleWidth1 * BaseRad
239RHW2 = m_RaisedHandleWidth2 * BaseRad
240 
241Dim BackL As Double, FrontL As Double
242FrontL = Sqr(BaseRad * BaseRad - RHW1 * RHW1)
243BackL = Sqr(BaseRad * BaseRad - RHW2 * RHW2)
244 
245Dim Color1 As Long, Color2 As Long
246Color1 = GetSysColor(vb3DHighlight And &HFF&)
247Color2 = GetSysColor(vb3DDKShadow And &HFF&)
248 
249Dim PtX(3) As Double
250Dim PtY(3) As Double
251 
252PtX(0) = m_Rad + DirX * FrontL + SideX * RHW1
253PtY(0) = m_Rad + DirY * FrontL + SideY * RHW1
254PtX(1) = m_Rad + DirX * FrontL - SideX * RHW1
255PtY(1) = m_Rad + DirY * FrontL - SideY * RHW1
256PtX(2) = m_Rad - DirX * BackL + SideX * RHW2
257PtY(2) = m_Rad - DirY * BackL + SideY * RHW2
258PtX(3) = m_Rad - DirX * BackL - SideX * RHW2
259PtY(3) = m_Rad - DirY * BackL - SideY * RHW2
260 
261DrawLighedLine picKnob, PtX(0), PtY(0), PtX(1), PtY(1), Color1, Color2
262DrawLighedLine picKnob, PtX(1), PtY(1), PtX(3), PtY(3), Color1, Color2
263DrawLighedLine picKnob, PtX(3), PtY(3), PtX(2), PtY(2), Color1, Color2
264DrawLighedLine picKnob, PtX(2), PtY(2), PtX(0), PtY(0), Color1, Color2
265 
266End Sub
267 
268'将数值转换为用于显示的角度值
269Private Function ValueToAngle(ByVal Value_ As Long, ByVal MaxValue_ As Long) As Double
270If MaxValue_ Then ValueToAngle = m_MinAng + (m_MaxAng - m_MinAng) * Value_ / MaxValue_ + Knob_PI * 0.5
271End Function
272 
273'将角度值转换为数值
274Private Function AngleToValue(ByVal Angle As Double) As Long
275If m_MaxAng = 0 Then Exit Function
276Angle = Angle - Knob_PI * 0.5
277While Angle < 0
278    Angle = Angle + Knob_PI * 2
279Wend
280While Angle > Knob_PI * 2
281    Angle = Angle - Knob_PI * 2
282Wend
283AngleToValue = (Angle - m_MinAng) * m_Max / (m_MaxAng - m_MinAng)
284End Function
285 
286'控件改变大小,重建底座图
287Private Sub picBase_Resize()
288DrawBaseCircle
289End Sub
290 
291'鼠标单击操作
292Private Sub picKnob_Click()
293RaiseEvent Click
294End Sub
295 
296'鼠标双击操作
297Private Sub picKnob_DblClick()
298RaiseEvent DblClick
299End Sub
300 
301'键盘按下操作
302Private Sub picKnob_KeyDown(KeyCode As Integer, Shift As Integer)
303RaiseEvent KeyDown(KeyCode, Shift)
304End Sub
305 
306'键盘打字操作
307Private Sub picKnob_KeyPress(KeyAscii As Integer)
308RaiseEvent KeyPress(KeyAscii)
309End Sub
310 
311'键盘弹起操作
312Private Sub picKnob_KeyUp(KeyCode As Integer, Shift As Integer)
313RaiseEvent KeyUp(KeyCode, Shift)
314End Sub
315 
316'鼠标按下操作
317Private Sub picKnob_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
318m_MouseDown = True
319m_MouseAngle = GetAngle(X - m_Rad, Y - m_Rad) - ValueToAngle(m_Value, m_Max)
320DrawHandle
321RaiseEvent MouseDown(Button, Shift, X, Y)
322End Sub
323 
324'鼠标移动操作
325Private Sub picKnob_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
326If m_MouseDown Then
327    Dim NewAng As Double, OldVal As Long
328    NewAng = GetAngle(X - m_Rad, Y - m_Rad) - m_MouseAngle
329    OldVal = m_Value
330    m_Value = AngleToValue(NewAng)
331    If m_Value > m_Max Then m_Value = m_Max
332    If m_Value < 0 Then m_Value = 0
333    picKnob.ToolTipText = m_Value
334    DrawHandle
335    RaiseEvent MouseMove(Button, Shift, X, Y)
336    If OldVal <> m_Value Then
337        RaiseEvent Change(OldVal, m_Value)
338        m_MouseAngle = GetAngle(X - m_Rad, Y - m_Rad) - ValueToAngle(m_Value, m_Max)
339    ElseIf m_Value = 0 Or m_Value = m_Max Then
340        m_MouseAngle = GetAngle(X - m_Rad, Y - m_Rad) - ValueToAngle(m_Value, m_Max)
341    End If
342End If
343End Sub
344 
345'鼠标松开操作
346Private Sub picKnob_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
347m_MouseDown = False
348DrawHandle
349RaiseEvent MouseUp(Button, Shift, X, Y)
350End Sub
351 
352Private Sub picKnob_Resize()
353picBase.Move 0, 0, picKnob.ScaleWidth, picKnob.ScaleHeight
354DrawHandle
355End Sub
356 
357'控件初始化
358Private Sub UserControl_Initialize()
359UserControl_Resize
360End Sub
361 
362Private Sub UserControl_InitProperties()
363m_Max = 100
364m_Value = 100
365m_Steps = 3
366m_BaseRad = 0.75
367m_HandleRad = 0.8
368m_MinAng = Knob_PI / 3
369m_MaxAng = Knob_PI * 5 / 3
370m_DrawGrad = True
371m_DrawPoint = True
372m_DrawRaisedHandle = True
373m_RaisedHandleWidth1 = 0.3
374m_RaisedHandleWidth2 = 0.3
375End Sub
376 
377Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
378m_Max = PropBag.ReadProperty("Max", m_Max)
379m_Value = PropBag.ReadProperty("Value", m_Value)
380m_Steps = PropBag.ReadProperty("Steps", m_Steps)
381m_BaseRad = PropBag.ReadProperty("BaseRadius", m_BaseRad)
382m_HandleRad = PropBag.ReadProperty("HandleRadius", m_HandleRad)
383m_MinAng = PropBag.ReadProperty("MinAngle", m_MinAng)
384m_MaxAng = PropBag.ReadProperty("MaxAngle", m_MaxAng)
385m_DrawGrad = PropBag.ReadProperty("DrawGraduation", m_DrawGrad)
386m_DrawPoint = PropBag.ReadProperty("DrawPoint", m_DrawPoint)
387m_DrawRaisedHandle = PropBag.ReadProperty("DrawRaisedHandle", m_DrawRaisedHandle)
388m_RaisedHandleWidth1 = PropBag.ReadProperty("RaisedHandleWidth1", m_RaisedHandleWidth1)
389m_RaisedHandleWidth2 = PropBag.ReadProperty("RaisedHandleWidth2", m_RaisedHandleWidth2)
390picKnob.BorderStyle = PropBag.ReadProperty("BorderStyle", picKnob.BorderStyle)
391m_Rad = picKnob.ScaleHeight \ 2
392DrawKnob
393End Sub
394 
395Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
396PropBag.WriteProperty "Max", m_Max
397PropBag.WriteProperty "Value", m_Value
398PropBag.WriteProperty "Steps", m_Steps
399PropBag.WriteProperty "BaseRadius", m_BaseRad
400PropBag.WriteProperty "HandleRadius", m_HandleRad
401PropBag.WriteProperty "MinAngle", m_MinAng
402PropBag.WriteProperty "MaxAngle", m_MaxAng
403PropBag.WriteProperty "DrawGraduation", m_DrawGrad
404PropBag.WriteProperty "DrawPoint", m_DrawPoint
405PropBag.WriteProperty "DrawRaisedHandle", m_DrawRaisedHandle
406PropBag.WriteProperty "RaisedHandleWidth1", m_RaisedHandleWidth1
407PropBag.WriteProperty "RaisedHandleWidth2", m_RaisedHandleWidth2
408PropBag.WriteProperty "BorderStyle", picKnob.BorderStyle
409End Sub
410 
411'控件改变大小
412Private Sub UserControl_Resize()
413If Width > Height Then
414    Width = Height
415    Exit Sub
416ElseIf Width < Height Then
417    Height = Width
418    Exit Sub
419End If
420picKnob.Height = ScaleHeight
421m_Rad = picKnob.ScaleHeight \ 2
422DrawKnob
423End Sub
424 
425'取得角度
426Private Function GetAngle(ByVal X As Double, ByVal Y As Double) As Double
427'X为Cos计算出来的,Y为Sin计算出来的
428If X > 0 Then
429    GetAngle = Atn(Y / X)
430ElseIf X < 0 Then
431    GetAngle = Atn(Y / X) + Knob_PI
432ElseIf Y > 0 Then
433    GetAngle = Knob_PI / 2
434ElseIf Y < 0 Then
435    GetAngle = Knob_PI * 3 / 2
436End If
437End Function
438 
439'边框属性,继承的PictureBox的边框属性
440Property Get BorderStyle() As Long
441Attribute BorderStyle.VB_Description = "The style of the border. Same as PictureBox."
442Attribute BorderStyle.VB_ProcData.VB_Invoke_Property = ";外观"
443Attribute BorderStyle.VB_UserMemId = -504
444BorderStyle = picKnob.BorderStyle
445End Property
446 
447Property Let BorderStyle(ByVal NewBorderStyle As Long)
448picKnob.BorderStyle = NewBorderStyle
449m_Rad = picKnob.ScaleHeight \ 2
450DrawKnob
451PropertyChanged "BorderStyle"
452End Property
453 
454'旋钮的数值,取值0到Max
455Property Get Value() As Long
456Attribute Value.VB_Description = "The value of the knob."
457Attribute Value.VB_ProcData.VB_Invoke_Property = ";行为"
458Attribute Value.VB_UserMemId = 0
459Value = m_Value
460End Property
461 
462Property Let Value(ByVal NewValue As Long)
463If NewValue < 0 Then
464    m_Value = 0
465ElseIf NewValue > m_Max Then
466    m_Value = m_Max
467Else
468    m_Value = NewValue
469End If
470DrawHandle
471PropertyChanged "Value"
472End Property
473 
474'旋钮的数值的最大值
475Property Get Max() As Long
476Attribute Max.VB_Description = "The maximum value"
477Attribute Max.VB_ProcData.VB_Invoke_Property = ";行为"
478Max = m_Max
479End Property
480 
481Property Let Max(ByVal NewMaxValue As Long)
482If NewMaxValue < 0 Then
483    m_Max = 0
484Else
485    m_Max = NewMaxValue
486End If
487If m_Value > m_Max Then m_Value = m_Max
488DrawKnob
489PropertyChanged "Max"
490End Property
491 
492'旋钮的最小角度
493Property Get MinAngle() As Double
494Attribute MinAngle.VB_Description = "The minimum angle the knob can turn."
495Attribute MinAngle.VB_ProcData.VB_Invoke_Property = ";外观"
496MinAngle = m_MinAng * 180 / Knob_PI
497End Property
498 
499Property Let MinAngle(ByVal NewMinAngle As Double)
500m_MinAng = NewMinAngle * Knob_PI / 180
501While m_MinAng > Knob_PI * 2
502    m_MinAng = m_MinAng - Knob_PI * 2
503Wend
504While m_MinAng < 0
505    m_MinAng = m_MinAng + Knob_PI * 2
506Wend
507If m_MaxAng < m_MinAng Then
508    Dim Temp As Double
509    Temp = m_MaxAng
510    m_MaxAng = m_MinAng
511    m_MinAng = Temp
512End If
513DrawKnob
514PropertyChanged "MinAngle"
515End Property
516 
517'旋钮的最大角度
518Property Get MaxAngle() As Double
519Attribute MaxAngle.VB_Description = "The maximum angle the knob can turn."
520Attribute MaxAngle.VB_ProcData.VB_Invoke_Property = ";外观"
521MaxAngle = m_MaxAng * 180 / Knob_PI
522End Property
523 
524Property Let MaxAngle(ByVal NewMaxAngle As Double)
525m_MaxAng = NewMaxAngle * Knob_PI / 180
526While m_MaxAng > Knob_PI * 2
527    m_MaxAng = m_MaxAng - Knob_PI * 2
528Wend
529While m_MaxAng < 0
530    m_MaxAng = m_MaxAng + Knob_PI * 2
531Wend
532If m_MinAng > m_MaxAng Then
533    Dim Temp As Double
534    Temp = m_MaxAng
535    m_MaxAng = m_MinAng
536    m_MinAng = Temp
537End If
538DrawKnob
539PropertyChanged "MaxAngle"
540End Property
541 
542'旋钮的刻度的密度
543Property Get Steps() As Long
544Attribute Steps.VB_Description = "The steps of the graduation."
545Attribute Steps.VB_ProcData.VB_Invoke_Property = ";外观"
546Steps = m_Steps
547End Property
548 
549Property Let Steps(ByVal NewSteps As Long)
550If NewSteps > m_Max Then
551    m_Steps = m_Max
552ElseIf NewSteps < 0 Then
553    m_Steps = 0
554Else
555    m_Steps = NewSteps
556End If
557DrawKnob
558PropertyChanged "Steps"
559End Property
560 
561'旋钮的圆盘的半径比例
562Property Get BaseRadius() As Double
563Attribute BaseRadius.VB_Description = "The radius of the base circle."
564Attribute BaseRadius.VB_ProcData.VB_Invoke_Property = ";外观"
565BaseRadius = m_BaseRad
566End Property
567 
568Property Let BaseRadius(ByVal NewBaseRadius As Double)
569If NewBaseRadius < 0 Then
570    m_BaseRad = 0
571Else
572    m_BaseRad = NewBaseRadius
573End If
574DrawKnob
575PropertyChanged "BaseRadius"
576End Property
577 
578'旋钮的把手的半径比例
579Property Get HandleRadius() As Double
580Attribute HandleRadius.VB_Description = "The radius(or length) of the raised handle."
581Attribute HandleRadius.VB_ProcData.VB_Invoke_Property = ";外观"
582HandleRadius = m_HandleRad
583End Property
584 
585Property Let HandleRadius(ByVal NewHandleRadius As Double)
586If NewHandleRadius < 0 Then
587    m_HandleRad = 0
588Else
589    m_HandleRad = NewHandleRadius
590End If
591DrawHandle
592PropertyChanged "HandleRadius"
593End Property
594 
595'是否绘制刻度
596Property Get DrawGraduation() As Boolean
597Attribute DrawGraduation.VB_Description = "Draw the graduation if it was true."
598Attribute DrawGraduation.VB_ProcData.VB_Invoke_Property = ";外观"
599DrawGraduation = m_DrawGrad
600End Property
601 
602Property Let DrawGraduation(ByVal NewVal As Boolean)
603m_DrawGrad = NewVal
604DrawKnob
605PropertyChanged "DrawGraduation"
606End Property
607 
608'是否绘制刻度
609Property Get DrawPoint() As Boolean
610Attribute DrawPoint.VB_Description = "Draw the red point if it was true."
611Attribute DrawPoint.VB_ProcData.VB_Invoke_Property = ";外观"
612DrawPoint = m_DrawPoint
613End Property
614 
615Property Let DrawPoint(ByVal NewVal As Boolean)
616m_DrawPoint = NewVal
617DrawHandle
618PropertyChanged "DrawPoint"
619End Property
620 
621'是否显示凸起的把手
622Property Get DrawRaisedHandle() As Boolean
623Attribute DrawRaisedHandle.VB_Description = "Draw the raised handle if it was true."
624Attribute DrawRaisedHandle.VB_ProcData.VB_Invoke_Property = ";外观"
625DrawRaisedHandle = m_DrawRaisedHandle
626End Property
627 
628Property Let DrawRaisedHandle(ByVal NewVal As Boolean)
629m_DrawRaisedHandle = NewVal
630DrawHandle
631PropertyChanged "DrawRaisedHandle"
632End Property
633 
634'凸起的把手的宽度1
635Property Get RaisedHandleWidth1() As Double
636Attribute RaisedHandleWidth1.VB_Description = "The width of the raised handle."
637Attribute RaisedHandleWidth1.VB_ProcData.VB_Invoke_Property = ";外观"
638RaisedHandleWidth1 = m_RaisedHandleWidth1
639End Property
640 
641Property Let RaisedHandleWidth1(ByVal NewVal As Double)
642m_RaisedHandleWidth1 = NewVal
643DrawHandle
644PropertyChanged "RaisedHandleWidth1"
645End Property
646 
647'凸起的把手的宽度2
648Property Get RaisedHandleWidth2() As Double
649Attribute RaisedHandleWidth2.VB_Description = "The width of the raised handle."
650Attribute RaisedHandleWidth2.VB_ProcData.VB_Invoke_Property = ";外观"
651RaisedHandleWidth2 = m_RaisedHandleWidth2
652End Property
653 
654Property Let RaisedHandleWidth2(ByVal NewVal As Double)
655m_RaisedHandleWidth2 = NewVal
656DrawHandle
657PropertyChanged "RaisedHandleWidth2"
658End Property

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多