OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   VB.Net X5 and graphic importation positional problem (http://forum.oberonplace.com/showthread.php?t=8078)

Mal 23-02-2012 09:58

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 :rotate:

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

Mal 23-02-2012 16:02

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)

All times are GMT -5. The time now is 22:47.

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