OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 23-02-2012, 08:58
Posts: n/a
Default VB.Net X5 and graphic importation positional problem


I'm using VB.net (Visual Studio 2008) to automate importing EPS files into X5. This works, sorta.

The problem is, on my development machine, they import to the center of the screen. From there I move them around and perform other operations. It works great.

I install the application on a different machine and the eps files import but they're in the wrong place.

Both machines run Windows 7, both machines are on Corel X5, fully updated.

I wrote a code snippet that duplicates the behavior without all my extra stuff. It simply opens a page and imports a graphic.

I've done the F8/reset workspace. Both machines are up to date on windows update. I just can't figure out what is causing the one machine to consistently put the graphic in the lower left. It's maddening

Any suggestions welcome! Thanks.

This is the code.

Private Sub Button2_Click( ByVal sender As System.Object,  ByVal e As System.EventArgs) Handles Button2.Click
                        dim cdraw As CorelDRAW.Application
                        dim impopt As new CorelDRAW.StructImportOptions
                        Dim createopt As New CorelDRAW.StructCreateOptions 
                        Dim doc1 As coreldraw.Document
                        cdraw =  CreateObject("Coreldraw.application")           

                        With createopt
                            .Name = "Untitled-1"
                            .Units = CorelDRAW.cdrUnit.cdrMillimeter
                            .PageWidth = 300#
                            .PageHeight = 420#
                            .Resolution = 300#
                           ' .ColorContext = CorelDRAW. CreateColorContext2("sRGB IEC61966-2.1,U.S. Web Coated (SWOP) v2,Dot Gain 20%", BlendingColorModel:=clrColorModelCMYK)
                        End With

                        doc1 = cdraw.CreateDocumentEx(createopt)

                        impopt = cdraw.CreateStructImportOptions
                        With impopt
                            .MaintainLayers = True
                        End With

                        Dim impflt As coreldraw.ImportFilter
                        impflt = cdraw.ActiveLayer.ImportEx("c:\testm\thisfile.eps", coreldraw.cdrFilter.cdrPSInterpreted, impopt)

                        cdraw = Nothing
End Sub
Reply With Quote
Old 23-02-2012, 15:02
Posts: n/a

I figured out a solutions.

Just center it to the page. Duh. This way it won't matter where it lands, I know for sure where it is once centered.

Now it works as expected.

The code I added is below.

Dim OrigSelection As new coreldraw.ShapeRange
OrigSelection = cdraw.ActiveSelectionRange
OrigSelection.AlignToPageCenter(CorelDRAW.cdrAlignType.cdrAlignLeft + CorelDRAW.cdrAlignType.cdrAlignRight + coreldraw.cdrAlignType.cdrAlignTop + CorelDRAW.cdrAlignType.cdrAlignBottom, CorelDRAW.cdrTextAlignOrigin.cdrTextAlignBoundingBox)
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Marking centers of graphic zimmerman General 2 23-09-2011 10:28
Create a Border from a Graphic Element jfelder General 3 28-06-2010 13:41
Graphic Styles in VBA julvr CorelDRAW/Corel DESIGNER VBA 2 15-05-2009 08:25
Graphic And Text jocenunes CorelDRAW/Corel DESIGNER VBA 2 27-02-2008 08:13
scaling text & graphic Karen CorelDRAW CS 1 12-02-2004 13:50

All times are GMT -5. The time now is 05:03.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com