添加C1WPFChart快捷鍵

 C1Chart for WPF 提供了強(qiáng)大、豐富的界面元素、動(dòng)態(tài)和數(shù)據(jù)綁定功能。這個(gè)控件擁有和最終用戶交互的內(nèi)置功能。最終用戶可以使用Mouse和 Shift 鍵配合使用來(lái)搜索、旋轉(zhuǎn)和縮放 C1Chart。

創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),迪慶州企業(yè)網(wǎng)站建設(shè),迪慶州品牌網(wǎng)站建設(shè),網(wǎng)站定制,迪慶州網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,迪慶州網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

有很多用戶向我們?cè)儐?wèn),如何添加C1WPFChart 快捷鍵。這篇文章將闡述如何實(shí)現(xiàn)這個(gè) Case。


這種方法非常簡(jiǎn)單。手動(dòng)的設(shè)置焦點(diǎn)到C1Chart 后你可以控制 keyboard 事件同時(shí)添加相應(yīng)代碼來(lái)實(shí)現(xiàn)快捷鍵的添加。但是,定制的快捷鍵并非是全局的,必須在 C1Chart 獲得焦點(diǎn)的情況下才起作用。
在本文章中,我們將展示使用KeyDown/KeyUp 來(lái)實(shí)現(xiàn)縮放功能。實(shí)現(xiàn)代碼如下: 

 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 Then13            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 Then23            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 Then33            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 If42 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 使用過(guò)程中遇到的問(wèn)題。

了解更多,請(qǐng)登錄:

葡萄城控件產(chǎn)品網(wǎng)站:http://www.gcpowertools.com.cn/ 
葡萄城技術(shù)支持論壇:http://gcdn.grapecity.com/

本文題目:添加C1WPFChart快捷鍵
當(dāng)前鏈接:http://muchs.cn/article32/jcjhsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營(yíng)銷型網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、電子商務(wù)、網(wǎng)站收錄、用戶體驗(yàn)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)