Skip to main content

Command Palette

Search for a command to run...

[js宏]wps演示中多顶点矩形

Updated
1 min read
 function CreateDialog_CommandButton1_Click()

{

    let nodesAdd=CreateDialog.SpinButton1.Value-4;

    let linesAdd=nodesAdd==0?0:nodesAdd/2;

    let myDocument = Application.ActivePresentation.Slides.Item(1)

    let theShape=myDocument.Shapes.AddShape(msoShapeRectangle, 50, 50, 200, 20)

    theShape.TextFrame.TextRange.Text="New Shape"

    var subShapes=new Array();

    subShapes.push(theShape.Name);

    var subL=theShape.Left;

    var subT=theShape.Top;

    var subH=theShape.Height

    let subGap=theShape.Width/(linesAdd+1);

    for(i=1;i<linesAdd+1;i++){

        subL+=subGap;

        var shape1=myDocument.Shapes.AddShape(msoShapeRectangle,subL,subT,1,subH);

        shape1.Fill.Transparency=1.0;

        shape1.Line.Transparency=1.0;

        subShapes.push(shape1.Name);

    }

    if(linesAdd>0){

        myDocument.Shapes.Range(subShapes).Group();

    }

   CreateDialog.Close();

}

More from this blog

解决QWidget用winId获取HWND而导致Qt程序无事件消息的问题

问题原因: 当对一个QWidget调用winId时,默认情况下,Qt会对该窗口进行Native化,从而导致如鼠标等事件被其它原生窗口接管,表现出来的现像就是窗口不响应任何事件 解决思路: 防止Qt窗口Native化 解决办法: 第一步,在创建QApplication对象之前设置: QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); //注意:Qt::AA_NativeWindows受环境变量 QT_USE_NATI...

Jul 7, 20251 min read

解决因OpenGL渲染窗口高宽比导致图形变形

在 OpenGL 中,由于窗口的 宽高比(aspect ratio) 与绘制内容的坐标系统不一致,图像会出现拉伸、压缩等变形现象。为了解决这个问题,可根据窗口的大小调整投影矩阵,确保图像在视觉上保持原始比例。 先通过glViewPort调整视口 void resizeGL(int w, int h) { glViewport(0, 0, w, h); } 再根据窗口高宽比,计算出合适的投影矩阵,这样体现出来的样式,就是截掉了宽高比之外的内容,显示的内容不变形,正圆就是正圆,不会被拉伸成...

Jun 18, 20251 min read

雷的部落格威力缩小版

29 posts

雷的部落格威力缩小版