如何实现 printPreviewControl 的 鼠标滚轮 (MouseWheel) 事件

hhq2000 2008-01-07 11:11:15
如何实现 printPreviewControl 的 鼠标滚轮 (MouseWheel) 事件
...全文
277 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
changjiangzhibin 2008-01-08
  • 打赏
  • 举报
回复
up
hhq2000 2008-01-08
  • 打赏
  • 举报
回复
有c#代码吗,vb的看不懂。
我的msn:hhq2000@msn.com,发段完整的代码给我也行
hhq2000 2008-01-08
  • 打赏
  • 举报
回复
好的我试一下先
benyouyong 2008-01-08
  • 打赏
  • 举报
回复
“丆”是贴导TXT的转换乱码。我也不知道哪来的。。去掉就可以了。
hhq2000 2008-01-08
  • 打赏
  • 举报
回复
benyouyong 有乱码,能再贴一下吗?
benyouyong 2008-01-08
  • 打赏
  • 举报
回复
看下面这个你能不能用的着。
code


Private Const PM_REMOVE = &H1
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As Msg丆 ByVal hWnd As Long丆 ByVal wMsgFilterMin As Long丆 ByVal wMsgFilterMax As Long丆 ByVal wRemoveMsg As Long) As Long
Private Declare Function WaitMessage Lib "user32" () As Long
Private bCancel As Boolean
Private Const WM_MOUSEWHEEL = 522

Private Sub ProcessMessages()
Dim Message As Msg
Do While Not bCancel
WaitMessage 'Wait For message and...
If PeekMessage(Message丆 Me.hWnd丆 WM_MOUSEWHEEL丆 WM_MOUSEWHEEL丆 PM_REMOVE) Then '...when the mousewheel is used...
If Message.wParam < 0 Then '...scroll up...
Me.Top = Me.Top + 240
Else '... or scroll down
Me.Top = Me.Top - 240
End If
End If
DoEvents
Loop
End Sub

Private Sub Form_Load()
Me.AutoRedraw = True
Me.Print "Please use now mouse wheel to move this form."
Me.Show
ProcessMessages
End Sub

Private Sub Form_Unload(Cancel As Integer)
bCancel = True
End Sub
hhq2000 2008-01-08
  • 打赏
  • 举报
回复
我使用如下代码:
this.printPreviewControl1.MouseWheel +=
new System.Windows.Forms.MouseEventHandler(this.printPreviewControl1_MouseWheel);
但没有代用这个方法
zhouxian0518 2008-01-08
  • 打赏
  • 举报
回复
用委托

110,552

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧