彩票走势图

logo VectorDraw教程
文档彩票走势图>>VectorDraw教程>>新手入门必看:VectorDraw 常见问题整理大全(十九)

新手入门必看:VectorDraw 常见问题整理大全(十九)


VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。

VectorDraw Developer Framework最新版下载

VectorDraw web library (javascript)是一个矢量图形库。VectorDraw web library (javascript)不仅能打开CAD图纸,而且能显示任何支持HTML5标准平台上的通用矢量对象,如Windows,安卓,iOS和Linux。无需任何安装,VectorDraw web library (javascript)就可以运行在任何支持canvas标签和Javascript的主流浏览器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。

VectorDraw web library (javascript)最新版下载

一. 通过单击一个来选择多个连续实体的方法

问:请问可以通过单击一个来选择多个连续实体的方法是什么?

答:由于图中的实体没有完全相互持续,并且其中一些实体存在一个小的“间隙”,因此你需要使用如下所示代码:

                vdFigure fig;
                gPoint pt;
                doc.Prompt("select a curve");
                doc.ActionUtility.getUserEntity(out fig,out pt);
                doc.Prompt(null);
                vdCurve curve = fig as vdCurve;
                if(curve == null) return;
                
                gPoint sp = curve.getStartPoint();
                gPoint ep = curve.getEndPoint();

               

                vdSelection set = new vdSelection();
                set.SetUnRegisterDocument(doc);
                set.AddItem(curve, true, vdSelection.AddItemCheck.RemoveInVisibleEntities);

                double equality = 0.01;
                int pos = 0;
                while (pos < set.Count && sp != null && ep != null)
                {

                    gPoints pts = new gPoints();
                    pts.Add((sp - new gPoint(equality, equality)));
                    pts.Add((sp + new gPoint(equality, equality)));
                    set.Select(RenderSelect.SelectingMode.CrossingWindowRectangle, pts);

                    pts = new gPoints();
                    pts.Add((ep - new gPoint(equality, equality)));
                    pts.Add((ep + new gPoint(equality, equality)));
                    set.Select(RenderSelect.SelectingMode.CrossingWindowRectangle, pts);
                    pos++;
                    sp = null;
                    ep = null;
                    for (int i = pos; i < set.Count; i++)
                    {
                        
                        curve = set[i] as vdCurve;
                        if (curve != null)
                        {
                            sp = curve.getStartPoint();
                            ep = curve.getEndPoint();
                            break;
                        }
                        pos++;
                    }

                }
                doc.UndoHistory.StoreUndoGroup(true);
                foreach (vdFigure ent in set)
                {
                    ent.PenColor = new vdColor(Color.Blue);
                    ent.LineWeight = VectorDraw.Professional.Constants.VdConstLineWeight.LW_120;
                }
                doc.UndoHistory.StoreUndoGroup(false);
                set.Invalidate();

二. 使命令的行文本框接受空格键为enter

问:当我按下回车键并按空格键时,我想使命令行的行为相同。

答:你需要使用Command的行userText框事件KeyDown,并在按下空格时向其发送一条输入消息,如下代码所示:

void UserText_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
VectorDraw.WinMessages.MessageManager.MSG m = new VectorDraw.WinMessages.MessageManager.MSG();
m.hwnd = vdFramedControl1.CommandLine.UserText.Handle;
m.lParam = IntPtr.Zero;
m.message = (int)VectorDraw.WinMessages.MessageManager.Messages.WM_KEYDOWN;
m.wParam = (IntPtr)Keys.Enter;

VectorDraw.WinMessages.MessageManager.TranslateMessage(ref m);
VectorDraw.WinMessages.MessageManager.DispatchMessage(ref m);
}
}

private void Form1_Load(object sender, EventArgs e)
{
vdFramedControl1.CommandLine.UserText.KeyDown += new KeyEventHandler(UserText_KeyDown);
}

三. 在cmdText启动之前设置文本的高度

问:文档的全局/默认文本高度是否存在?我想要这个,因为当我想从用户输入高度值时,它在用户创建此vdtext时不会影响当前的vdtext。当用户按照你在先前邮件中的建议完成命令时,高度会生效。但我希望用户在撰写文本时可以看到新的高度。

答:你可以在cmdText启动之前设置文本的高度。请参阅下面的代码和备注:

        private void button3_Click(object sender, EventArgs e)
        {
            vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument;
            doc.New();
            cmdTextWithHeight(doc, null, null, null, 5.0);
            cmdTextWithHeight(doc, "VDF version6", new gPoint(30,30), null, 15.0);
            cmdTextWithHeight(doc, null, new gPoint(10,10), 0.0d, 25.0);
            cmdTextWithHeight(doc, "hi", null, 30.0, 35.0);
        }

        private bool cmdTextWithHeight(vdDocument document, object TextString, object InsertionPoint, object RotationAngle, double TextHeight)
        {
            bool ret = false;
            double oldheight = document.ActiveTextStyle.Height; // store the old value to set this back after this finishes
            document.ActiveTextStyle.Height = TextHeight;// set the Height that is needed to activetextstyle
            if (document.CommandAction.CmdText(TextString, InsertionPoint, RotationAngle))
            {
                vdText txt = document.ActiveLayOut.Entities[document.ActiveLayOut.Entities.Count - 1] as vdText; // get the text that was just created
                if (txt != null)
                {
                    //... do other things there with the just-created-vdText if you like !!
                    txt.Height = TextHeight; // see it to the Height so evene if activeTextStyle changes this remains.
                    ret = true;
                }

            }
            document.ActiveTextStyle.Height = oldheight; // set the original value back.
            return ret;
        }

未完待续~

热门活动

*点击图片查看活动详情*

ABViewer免费送

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP