温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

添加C1WPFChart快捷键

发布时间:2020-06-24 20:51:18 来源:网络 阅读:452 作者:C1SupportTeam 栏目:编程语言

 C1Chart for WPF 提供了强大、丰富的界面元素、动态和数据绑定功能。这个控件拥有和最终用户交互的内置功能。最终用户可以使用Mouse和 Shift 键配合使用来搜索、旋转和缩放 C1Chart。

有很多用户向我们询问,如何添加C1WPFChart 快捷键。这篇文章将阐述如何实现这个 Case。


这种方法非常简单。手动的设置焦点到C1Chart 后你可以控制 keyboard 事件同时添加相应代码来实现快捷键的添加。但是,定制的快捷键并非是全局的,必须在 C1Chart 获得焦点的情况下才起作用。
在本文章中,我们将展示使用KeyDown/KeyUp 来实现缩放功能。实现代码如下: 

 1 Private Sub Chart1_MouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs Handles Chart1.MouseLeftButtonDown   2      'Setting the Focus manually. 
 3      'Without forcing this Focus, the keyboard events are not recognised. 
 4       Chart1.Focus()   5 End Sub  6   
 7 Private Sub Chart1_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles Chart1.<span>PreviewKeyDown   8       Chart1.View.AxisX.MinScale = 0.001 
 9       Chart1.View.AxisY.MinScale = 0.001 
10   
11       'Checking the pressed key 
12       If e.Key = Key.Down Then 13            Chart1.BeginUpdate()  14   
15            'Decreasing the scale values in order to ZoomIn 
16            Chart1.View.AxisX.Scale = Chart1.View.AxisX.Scale - 0.35 
17            Chart1.View.AxisY.Scale = Chart1.View.AxisY.Scale - 0.35 
18   
19            UpdateScrollbars()  20            Chart1.EndUpdate()  21   
22       ElseIf e.Key = Key.Up Then 23            Chart1.BeginUpdate()  24   
25           'Increasing the scale values in order to ZoomOut 
26            Chart1.View.AxisX.scale = Chart1.View.AxisX.Scale + 0.35 
27            Chart1.View.AxisY.Scale = Chart1.View.AxisY.Scale + 0.35 
28   
29            UpdateScrollbars()  30            Chart1.EndUpdate()  31   
32       ElseIf e.Key = Key.Escape Then 33            Chart1.BeginUpdate()  34   
35            'Setting the Scale to Default Value 
36            Chart1.View.AxisX.Scale = 1 
37            Chart1.View.AxisY.Scale = 1 
38   
39            UpdateScrollbars()  40            Chart1.EndUpdate()  41       End If 42 End Sub

添加C1WPFChart快捷键cdn.grapecity.com/p_w_upload.aspx?p_w_uploadid=3612">

×××:

C#:Wpf_Chart_KeyboardShortcuts_CS.zip 

VB:Wpf_Chart_KeyBoardShortcuts.zip 

很高兴能和大家分享 ComponentOne 的使用方法、讨论 ComponentOne 使用过程中遇到的问题。

了解更多,请登录:

葡萄城控件产品网站:http://www.gcpowertools.com.cn/ 
葡萄城技术支持论坛:http://gcdn.grapecity.com/

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI