翻譯|使用教程|編輯:況魚杰|2020-01-02 09:35:45.930|閱讀 226 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學(xué)習(xí)。本文將會展示如何實現(xiàn)禁用鼠標平移以及鼠標滾輪縮放。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個用于應(yīng)用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導(dǎo)出。
點擊立即下載VectorDraw Developer Framework
問:
請問是否可以實現(xiàn)禁用鼠標平移以及鼠標滾輪縮放。在禁用滾輪同時,還想要控制圖形的水平和垂直滾動。怎樣才能做到這一點?
答:
禁用鼠標中鍵平移和鼠標滾輪放大/縮小:
對于包裝器,我們必須獲取如下的vdDocument對象。
VectorDraw.Professional.vdObjects.vdDocument doc = vd.ActiveDocument.WrapperObject as VectorDraw.Professional.vdObjects.vdDocument; doc.MouseWheelZoomScale = 1.0;
1.0表示禁用了鼠標滾輪。 0.8(小于1.0)或1.2(大于1.0)值可以反轉(zhuǎn)鼠標滾輪功能。
為了禁用平移,您必須使用JobStart事件,如下所示。
vd.JobStart += new AxVDrawLib5._DVdrawEvents_JobStartEventHandler(vd_JobStart); void vd_JobStart(object sender, AxVDrawLib5._DVdrawEvents_JobStartEvent e) {if (e.jobName == "BaseAction_ActionPan") e.cancel = 1;}要滾動視圖,請使用如下代碼:
... // these events must be used doc.MouseWheelZoomScale = 1.0d; // disable mouse wheel zoom doc.ActionStart += new vdDocument.ActionStartEventHandler(doc_ActionStart); vdFramedControl1.BaseControl.MouseWheel += new MouseEventHandler(BaseControl_MouseWheel); ... void BaseControl_MouseWheel(object sender, MouseEventArgs e) { if ((e != null) && (e.Delta != 0)) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; double height = doc.ActiveRender.Height * doc.ActiveRender.PixelSize; double width = doc.ActiveRender.Width * doc.ActiveRender.PixelSize; double stepY = height * (e.Delta / Math.Abs(e.Delta)) / 10.0d; double stepX = width * (-1.0d * e.Delta / Math.Abs(e.Delta)) / 10.0d; if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { // if Shift key is pressed scroll horizontally doc.ScrollActiveActionRenderView(stepX, 0.0d, true); // scroll only in dX } else //else scroll vertically { doc.ScrollActiveActionRenderView(0.0d, stepY, true); // scroll only in dY } } } void doc_ActionStart(object sender, string actionName, ref bool cancel) { if (actionName == "BaseAction_ActionPan") cancel = true; // cancel middle mouse button pan }
熱門文章推薦:
=======================================================
如果您對想要購買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guān)問題。
關(guān)注慧聚IT微信公眾號 ???,了解產(chǎn)品的最新動態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: