How SetGeometricBounds of a Rectangle

I am creating a rectangle using vc++.
There is a problem to use the SetGeometricBounds() function in vc++. It take one argument but there is requirement of four argument. But this function work welll in C#
InDesign.Rectangle rectangle = page.Rectangles.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, page);
rectangle.GeometricBounds = new[] { 20, 30, 120, 130 };
My Steps are
INDESIGN::Rectangle rectangle = rectangles.Add(covOptional,(long)1433299822,covOptional);
rectangle.SetGeometricBounds(const VARIANT &newValue);
SetGeometricBounds() function take one argument const VARIANT &newValue but parameter should be Array of Measurement Unit (Number or String). When i pass an array of these measurement unit then it also give error.
Thanks

You apparently use C++ with the "high level" scripting API, while this forum is traditionally the place for "low level" plugins. For scripting API questions probably your issues are better answered in the scripting forum even though I think you'll earn some stares when you mention your choice of C++. Why would you jump thru hoops of that more demanding language just to end up at the same thing that you'd get with a better supported scripting language?
Anyway, if you're in doubt what to feed into a setter method, just use the matching getter and inspect the result. It is again beyond me though how to use reflection of managed code in C++. I'd try just the equivalent to an array of 4 doubles if that differs from your quoted code "new [] {...}" above, but again I don't know how to produce that. Maybe add a "double" keyword at the appropriate place?
I think there are also some tools to disassemble your working C# code so you'd learn what magic conversions are used under the hood there.
Dirk

Similar Messages

  • How to programmatically add rectangle to a pdf file ?

    How to programmatically add rectangle to a pdf file ?
    There is several page pdfs, non-vector, black and white.
    Users are color blind and have disabilities.
    To train them, one adds a rectangle at a certain lower-left point and width,height specified for a page.
    The idea is to give the script the page and coordinates and size of rectangle to be added programmatically. Green rectangles are acceptable as the cones are most sensitive there.
    Also, additional feature to add bookmarks on the left in the order these rectangle data is provided to the script.
    The script could be "hard-wired" by a list of the rectangle coodinates, and page number, pasted inside acrobat and run or entered into acrobat in some way.
    Your script would help many disabled people who are distributed through out the world.
    Feel free to contact me by email if you wish.
    Dying Vets

    P.S.
    This rectangle does not have to be a full annotation rectangle which needs user,date and a lot of info.
    Something minimal like this would suffice
    1 0 0 RG % red for stroke color
    200 300 50 75 re
    As you can see that the native unit of the pdf file is the "point" having 72 in an inch.
    The file dpi would be given. However, one could assume that pixel for the rectangle lower-left and width/height are given.
    From the pixels and dpi, the points could be calculated if desired.

  • How to make a rectangle at say 75 degrees to simulate as branch of a tree

    I am making a game, I need to make a tree with branches with which, leaves can be attached. I am using rectangle as trunk of tree. What I want now is to use rectangles as branches of tree. I need to make rectangle like structure that is biased to say 75 degrees & attach it with trunk.
    How to make a rectangle that is biased to 75 degree OR is there any other object in java that I can use for this purpose.
    Thanks a lot for any help.

    Darryl.Burke wrote:
    AffineTransform#createTransformedShape
    dbarr db, thankya. I was looking for that one.

  • How to make a rectangle in a XY graph & this rectangle can be Drag and Zomm by Mouse

    I have a curve display in a XY graph, that is simple.
    But
       My customer want one or tree rectangle display in this graph also, these rectangle can be drag, Zoom,  such as below pic,
    the problem is how to use mouse control these Rect, Drag to move, Drag corner to Zoom.  thanks a lot

    Hi,
    First learn how to plot your rectangles (several segments).
    Then use a structure event with XYGraph => mouse down to check when user begin the drag
    Use the same structure event with XYGraph => mouse move to update your graph during movement.
    Best Regards
    V-F

  • Have placed video-when previewed there are sometimes heavy black lines around the image. If I place white rectangles in front, the black is hidden in Author, but when I preview the black lines are still there..How to use white rectangles to mask edges?

    I have placed video - when previewed there are sometimes heavy black lines around the image.
    If I place white rectangles in front, the black is hidden in Author, but when I preview the black lines are still there..
    How to use white rectangles to mask edges?

    Here's view in IBA you can see bounding boxes of white rectangles that
    form frame to block out black setions..
    Here's iBook preview image of same page, NO WHITE FRAME!
    WHY?
    BOB SPRAGUE

  • Indesign : how to move a rectangle object with his content ?

    hi
    i develop an indesign extension with flash builder and cs extension builder 2.
    when I move a rectangle object containing an image with the geometricBounds property the image does not move and is not visible anymore ...
    how to move a rectangle object with his content ?
    thanks
    Simon

    Use rectangle.move()

  • How to create a rectangle per entering dimensions rather than by drawing it

    how to create a rectangle per entering dimensions rather than by drawing it

    ReNewUs,
    Just click with the Rectangle Tool somewhere on the Artboard, then insert Width and height.

  • Confused about how to display a rectangle on JFrame

    i'm a little confused about how to display a rectangle on a jframe.
    I know there is a class called Rectangle. is there a way to use it to display a rectangle on a JFrame? i couldn't find a way to do that.
    i found a way to display a rectangle in the internet:
    CODE:
    public class RectangleFrame extends JFrame {
        public RectangleFrame() {
            super("My Rectangle");
            setSize(300,400);
            setLocation(300,300);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JButton button = new JButton("Button");
            JPanel panel = new JPanel();
            panel.add(button);
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(new Rect(), BorderLayout.CENTER);
            getContentPane().add(panel, BorderLayout.SOUTH);       
            setVisible(true);
        public static void main(String[] args) {
            new RectangleFrame();
    public class Rect extends JComponent {
        public void paint(Graphics g) {
            g.drawRect(50,50,200,200);
    }is this the only way to do that? isn't there an easier way? do i have to write this new class Rect i wrote?
    i don't really know how this Rect class i wrote works. could someone explain?
    then another question: can i put a rectangle on a JPanel or do i have to add it directly onto the ContentPane as i did above?
    i hope everything i asked is clear enough.
    thanks for your effort.

    Take a look at the 2D graphics tutorial:
    http://java.sun.com/docs/books/tutorial/2d/index.html

  • How to use the Rectangle class to draw an image and center it in a JPanel

    I sent an earlier post on how to center an image in a JPanel using the Rectangle class. I was asked to send an executable code which will show the malfunction. The code below is an executable code and a small part of a very big project. To simplifiy things, it is just a JFrame and a JPanel with an open dialog. Once executed the JFrame and the FileDialog will open. You can then navigate to a .gif or a .jpg picture and open it. What I want is for the picture to be centered in the middle of the JPanel and not the upper left corner. It is also important to stress that, I am usinig the Rectangle class to draw the Image. The region of interest is where the rectangle is created. In the constructor of the CenterRect class, I initialize the Rectangle class. Then I use paintComponent in the CenterRect class to draw the Image. The other classes are just support classes. The MyImage class is an extended image class which also has a draw() method. Any assistance in getting the Rectangle to show at the center of the JPanel without affecting the size and shape of the image will be greatly appreciated.
    I have divided the code into three parts. They are all supposed to be on one file in order to execute.
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class CenterRect extends JPanel {
        public static Rectangle srcRect;
        Insets insets = null;
        Image image;
        MyImage imp;
        private double magnification;
        private int dstWidth, dstHeight;
        public CenterRect(MyImage imp){
            insets = getInsets();
            this.imp = imp;
            int width = imp.getWidth();
            int height = imp.getHeight();
            ImagePanel.init();
            srcRect = new Rectangle(0,0, width, height);
            srcRect.setLocation(0,0);
            setDrawingSize(width, height);
            magnification = 1.0;
        public void setDrawingSize(int width, int height) {
            dstWidth = width;
            dstHeight = height;
            setSize(dstWidth, dstHeight);
        public void paintComponent(Graphics g) {
            Image img = imp.getImage();
         try {
                if (img!=null)
                    g.drawImage(img,0,0, (int)(srcRect.width*magnification), (int)(srcRect.height*magnification),
              srcRect.x, srcRect.y, srcRect.x+srcRect.width, srcRect.y+srcRect.height, null);
            catch(OutOfMemoryError e) {e.printStackTrace();}
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Opener().openImage();
    class Opener{
        private String dir;
        private String name;
        private static String defaultDirectory;
        JFrame parent;
        public Opener() {
            initComponents();
         public void initComponents(){
            parent = new JFrame();
            parent.setContentPane(ImagePanel.panel);
            parent.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            parent.setExtendedState(JFrame.MAXIMIZED_BOTH);
            parent.setVisible(true);
        public void openDialog(String title, String path){
            if (path==null || path.equals("")) {
                FileDialog fd = new FileDialog(parent, title);
                defaultDirectory = "dir.image";
                if (defaultDirectory!=null)
                    fd.setDirectory(defaultDirectory);
                fd.setVisible(true);
                name = fd.getFile();
                if (name!=null) {
                    dir = fd.getDirectory();
                    defaultDirectory = dir;
                fd.dispose();
                if (parent==null)
                    return;
            } else {
                int i = path.lastIndexOf('/');
                if (i==-1)
                    i = path.lastIndexOf('\\');
                if (i>0) {
                    dir = path.substring(0, i+1);
                    name = path.substring(i+1);
                } else {
                    dir = "";
                    name = path;
        public MyImage openImage(String directory, String name) {
            MyImage imp = openJpegOrGif(dir, name);
            return imp;
        public void openImage() {
            openDialog("Open...", "");
            String directory = dir;
            String name = this.name;
            if (name==null)
                return;
            MyImage imp = openImage(directory, name);
            if (imp!=null) imp.show();
        MyImage openJpegOrGif(String dir, String name) {
                MyImage imp = null;
                Image img = Toolkit.getDefaultToolkit().getImage(dir+name);
                if (img!=null) {
                    imp = new MyImage(name, img);
                    FileInfo fi = new FileInfo();
                    fi.fileFormat = fi.GIF_OR_JPG;
                    fi.fileName = name;
                    fi.directory = dir;
                    imp.setFileInfo(fi);
                return imp;
    }

    This is the second part. It is a continuation of the first part. They are all supposed to be on one file.
    class MyImage implements ImageObserver{
        private int imageUpdateY, imageUpdateW,width,height;
        private boolean imageLoaded;
        private static int currentID = -1;
        private int ID;
        private static Component comp;
        protected ImageProcessor ip;
        private String title;
        protected Image img;
        private static int xbase = -1;
        private static int ybase,xloc,yloc;
        private static int count = 0;
        private static final int XINC = 8;
        private static final int YINC = 12;
        private int originalScale = 1;
        private FileInfo fileInfo;
        ImagePanel win;
        /** Constructs an ImagePlus from an AWT Image. The first argument
         * will be used as the title of the window that displays the image. */
        public MyImage(String title, Image img) {
            this.title = title;
             ID = --currentID;
            if (img!=null)
                setImage(img);
        public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
             imageUpdateY = y;
             imageUpdateW = w;
             imageLoaded = (flags & (ALLBITS|FRAMEBITS|ABORT)) != 0;
         return !imageLoaded;
        public int getWidth() {
             return width;
        public int getHeight() {
             return height;
        /** Replaces the ImageProcessor, if any, with the one specified.
         * Set 'title' to null to leave the image title unchanged. */
        public void setProcessor(String title, ImageProcessor ip) {
            if (title!=null) this.title = title;
            this.ip = ip;
            img = ip.createImage();
            boolean newSize = width!=ip.getWidth() || height!=ip.getHeight();
         width = ip.getWidth();
         height = ip.getHeight();
         if (win!=null && newSize) {
                win = new ImagePanel(this);
        public void draw(){
            CenterRect ic = null;
            win = new ImagePanel(this);
            if (win!=null){
                win.addIC(this);
                win.getCanvas().repaint();
                ic = win .getCanvas();
                win.panel.add(ic);
                int width = win.imp.getWidth();
                int height = win.imp.getHeight();
                Point ijLoc = new Point(10,32);
                if (xbase==-1) {
                    xbase = 5;
                    ybase = ijLoc.y;
                    xloc = xbase;
                    yloc = ybase;
                if ((xloc+width)>ijLoc.x && yloc<(ybase+20))
                    yloc = ybase+20;
                    int x = xloc;
                    int y = yloc;
                    xloc += XINC;
                    yloc += YINC;
                    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
                    count++;
                    if (count%6==0) {
                        xloc = xbase;
                        yloc = ybase;
                    int scale = 1;
                    while (xbase+XINC*4+width/scale>screen.width || ybase+YINC*4+height/scale>screen.height)
                        if (scale>1) {
                   originalScale = scale;
                   ic.setDrawingSize(width/scale, height/scale);
        /** Returns the current AWT image. */
        public Image getImage() {
            if (img==null && ip!=null)
                img = ip.createImage();
            return img;
        /** Replaces the AWT image, if any, with the one specified. */
        public void setImage(Image img) {
            waitForImage(img);
            this.img = img;
            JPanel panel = ImagePanel.panel;
            width = img.getWidth(panel);
            height = img.getHeight(panel);
            ip = null;
        /** Opens a window to display this image and clears the status bar. */
        public void show() {
            show("");
        /** Opens a window to display this image and displays
         * 'statusMessage' in the status bar. */
        public void show(String statusMessage) {
            if (img==null && ip!=null){
                img = ip.createImage();
            if ((img!=null) && (width>=0) && (height>=0)) {
                win = new ImagePanel(this);
                draw();
        private void waitForImage(Image img) {
        if (comp==null) {
            comp = ImagePanel.panel;
            if (comp==null)
                comp = new JPanel();
        imageLoaded = false;
        if (!comp.prepareImage(img, this)) {
            double progress;
            while (!imageLoaded) {
                if (imageUpdateW>1) {
                    progress = (double)imageUpdateY/imageUpdateW;
                    if (!(progress<1.0)) {
                        progress = 1.0 - (progress-1.0);
                        if (progress<0.0) progress = 0.9;
    public void setFileInfo(FileInfo fi) {
        fi.pixels = null;
        fileInfo = fi;
    }

  • How to add a rectangle color frame for the video clips ?

    Hi there,
    I have shrink the 3 video clips small enough to fit all 3 of them into 1 screen.
    And now I want tomake a border rectangle color frame for these 3 video clips.
    Any tips on how I shall start ?
    Thanks & regards
    Cheers

    Ian R. Brown wrote:
    I have a feeling it can't be done because the border will probably go round the original full size video.
    A workaround would be to use the Custom generator to make a rectangle which you resize and put above the background.
    Then put your video you want framed on top of the lot and resize it so that a bit of the coloured Custom generator is showing all the way round.
    It's gonna be fiddly but simple enough in theory!
    Thanks Ian, that was a good idea.
    But my cropped video clip is a video clip being color-keyed (ie my video clip has alpha channel & the background is transparent). So putting a colour image behind the clip does not work because it will be seen through the alpha channel.
    Any tips ?
    Thanks

  • How to eliminate gray rectangles?

    Hello everybody,
    When I erase in Photoshop part of a drawing, gray rectancles appear. How can I eliminate them? In other words: every time I erase something, text or drawings, those gray rectangles appear. Is there a way to erase something leaving that part just white, so there I can write or draw whatever is needed?
    By the way I'm using Mac.
    Thanks in advance.
    R-t-L

    Hello,
    I have already seen where the layer is but I don't know how to convert the layer to a background layer or to add a white layer under that layer. 
    Thanks
    R-t-L

  • How to draw a rectangle with rounded corners?

    Hi,
    I'm trying to draw a rectangle in a custom annotation and my appearance stream looks like:
    1 1 98 98 re 0.5 w 1 j 0 0 0 RG S
    The re-operator draws the rectangle an the j-operator along with the parameter 1 sets the join style to round.
    It does make the corners very slightly rounded, but it's only visible when setting the zoom level 200% and beyond.
    Do any of you know how to make the corners more rounded for the rectangle?

    I thought so
    So Cubic Bézier curves all the way.
    Could you help me with it?

  • How to make one rectangle box line curved

    Hello:
    have started using Illustrator and love it but am unsure of how to do something.  What I have done is create a basic business card that has a white background.  I would like the bottom half of the card to be a different colour so I added a block of blue using the rectangle tool. That looks great but I would like the top line of the rectangle, which is in the middle of the card, to be in a wave like shape.
    How does one do that please ? Thank you.

    Effect >> Distort And Transform >> Zig Zag
    Make a rectangle shape for your mask
    Select the rectangle and the wave. Command 7 (Ctrl 7 on windows)to make a mask

  • How to avoid tiny rectangles showing up as separate pages in multipage PDFs scanned with Image Capture?

    I'm not sure I'm posting this question in the right forum. I am having a scanning problem. I’d appreciate it if anyone could explain what’s happening and suggest how to avoid it or how to fix it after the fact. I’m using a large-format scanner, the HP Officejet 7610, with a MacBook Pro, running OS X Yosemite, v.10.10.1. I am using Apple’s Image Capture app, v.6.6, for scanning software. I am scanning some newspapers, with text and photos on the pages, which are about 11” x 14-3/4” in size. I am making multipage PDFs, each about 10 pp., at a resolution of 300 dpi. Sometimes, when I scan a single page or multiple pages, one or more tiny rectangles of scan show up in the resulting PDF, following a normal page or between pages. In the Acrobat Reader, this tiny rectangle shows up as a curious little box, much less than an inch on a side, and when the PDF is printed out, the tiny rectangle is printed, too, as though it were a separate page. Why is this rectangle showing up in my scans? Is there a way to keep from getting it? After it has been made a part of a multipage PDF, is there any way to get rid of it, keeping the rest of the scan?

    I haven't received any replies to the question I recently posted, but one work-around that HP suggested is to use different scanning software. Instead of Image Capture, I used the HP Scan.app that came with my all-in-one printer. I haven't seen those rectangles in my PDFs since switching.

  • How to hide a rectangle graphic in a canvas ?

    Hi all,
    As we know we can draw rectangles from the tool pallette on a canvas. And I want to hide this rectangle under condition in my forms application. How can I achieve this ?
    Thank you very much indeed.

    <p>If your purpose is to have some "framed" text area, then you could find solutions in this article</p>
    Francois

Maybe you are looking for

  • How to replce the ename with last name & first name in this program

    Hi all, The below include program is with the reference of std report CATSSHOW. in which ename is the field to fetch the employee name, but now we want the emloyee name like last name & first name i.e in two separte column. how i implement this chang

  • Ipod touch 2nd gen and have ios 4.2.1. apps that will not download, higher ios version needed

    I have an ipod touch 2nd gen and have ios 4.2.1. I recently tried to download some apps and received a message that said I need a higher ios version (like 4.3 or higher). I know there used to be apps that worked before but I deleted them. When I trie

  • Connecting via dial up connection

    On a cisco router that has an aux port can be set up with a dial up connection as a backup. But, my question is how is this set up? for example, Do I plug in a land line to the router, setup the router aux port, and then dial in from anywhere? Or, is

  • Online Albums Issues with PSE7

    Does PSE7 offer a way to save online albums directly to my hard drive instead of just uploading them to Photoshop.com or to another website via FTP? Unlike PSE6, PSE7 doesn't seem to offer that option (at least, I couldn't find it) And can anyone tel

  • My cd drive not working

    ok, so here's what happened. I put a mini cd in my computer, the kind that's the size of a gamecube disk. i guess because of the size of the thing, the computer couldn't/didn't read it, and it got stuck inside. After some wiggling with a heavy piece