2024年5月6日发(作者:)

26

27 protected int moLargeChange = 10;

28 protected int moSmallChange = 1;

29 protected int moMinimum = 0;

30 protected int moMaximum = 100;

31 protected int moValue = 0;

32 private int nClickPoint;

33

34 protected int moThumbTop = 0;

35

36 protected bool moAutoSize = false;

37

38 private bool moThumbDown = false;

39 private bool moThumbDragging = false;

40

41 public new event EventHandler Scroll = null;

42 public event EventHandler ValueChanged = null;

43

44 private int GetThumbHeight()

45 {

46 int nTrackHeight = ( - ( + ));

47 float fThumbHeight = ((float)LargeChange / (float)Maximum) * nTrackHeight;

48 int nThumbHeight = (int)fThumbHeight;

49

50 if (nThumbHeight > nTrackHeight)

51 {

52 nThumbHeight = nTrackHeight;

53 fThumbHeight = nTrackHeight;

54 }

55 if (nThumbHeight < 56)

56 {

57 nThumbHeight = 56;

58 fThumbHeight = 56;

59 }

60

61 return nThumbHeight;

62 }

63

64 public CustomScrollbar()

65 {

66

67 InitializeComponent();

68 SetStyle(Redraw, true);

69 SetStyle(ntingInWmPaint, true);

70 SetStyle(Buffer, true);

71

72 moChannelColor = gb(51, 166, 3);

73 UpArrowImage = w;

74 DownArrowImage = row;

75

76

77 ThumbBottomImage = ottom;

78

79 ThumbMiddleImage = iddle;

80

81 = ;

82 mSize = new Size(, + + GetThumbHeight());

83 }

84

85 [EditorBrowsable(), Browsable(true), DefaultValue(false), Category("Behavior"), Description

86

87 ("LargeChange")]

88 public int LargeChange

89 {

90 get { return moLargeChange; }

91 set

92 {

93 moLargeChange = value;

94 Invalidate();

95 }

96 }

97

98 [EditorBrowsable(), Browsable(true), DefaultValue(false), Category("Behavior"), Description