OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 01-09-2021, 10:58
VyperOne VyperOne is offline
Join Date: Feb 2003
Posts: 38
Default Events

I have come to need to be able to handle the CorelDRAW.Document.ShapeChange event in vb.net. Searching this forum I cannot find complete information on how to do this invb.net. Does anyone have an example on how to catch this event?
Reply With Quote
Old 04-09-2021, 00:36
shelbym's Avatar
shelbym shelbym is offline
Senior Member
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,791
Blog Entries: 13
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Events

I have put together an Example Docker for you.

This example is a Custom Docker written in VB.NET. I will include the entire solution as an attachment. You will need Visual Studio to open / edit it. The Docker uses .NET 4.8 and should work for CorelDRAW X7 - CorelDRAW 2021.

To install the docker you would copy the files to the Addons folder. So for example CorelDRAW 2021 would look like this:

C:\Program Files\Corel\CorelDRAW Graphics Suite 2021\Programs64\Addons\ShapeChangeExampleDocker

The docker has a single TextBox and as each Event fires I put it in the TextBox so you can see when they fire.

I added all the Events for Shape because you maybe surprised when one fires. For example if you move a shape the ShapeMove fires but the ShapeChange does not. The ShapeChange will fire when you say apply a fill to the shape.

Here is what the docker looks like:
Name:  ShapeChangeExampleDocker.PNG
Views: 234
Size:  12.4 KB
For those who do not want to download the zip the main code looks like this:
Imports Corel.Interop.VGCore

Public Class DockerUI
    Dim WithEvents corelApp As Application
    Dim WithEvents curDoc As Document

    Public Sub New(app As Object)
        corelApp = CType(app, Application)

        EventsTextBox.Text = "Docker Loaded" + Environment.NewLine
    End Sub

    Private Sub corelApp_WindowActivate(Doc As Document, Window As Window) Handles corelApp.WindowActivate
        curDoc = Doc
        EventsTextBox.Text += "Window Activate" + Environment.NewLine
    End Sub

    Private Sub corelApp_WindowDeactivate(Doc As Document, Window As Window) Handles corelApp.WindowDeactivate
        curDoc = Nothing
        EventsTextBox.Text += "Window DeActivate" + Environment.NewLine
    End Sub

    Private Sub curDoc_ShapeChange(Shape As Shape, Scope As cdrShapeChangeScope) Handles curDoc.ShapeChange
        EventsTextBox.Text += "Shape Change" + Environment.NewLine
    End Sub

    Private Sub curDoc_ShapeCreate(Shape As Shape) Handles curDoc.ShapeCreate
        EventsTextBox.Text += "Shape Create" + Environment.NewLine
    End Sub

    Private Sub curDoc_ShapeDelete(Count As Integer) Handles curDoc.ShapeDelete
        EventsTextBox.Text += "Shape Delete" + Environment.NewLine
    End Sub

    Private Sub curDoc_ShapeDistort(Shape As Shape) Handles curDoc.ShapeDistort
        EventsTextBox.Text += "Shape Distort" + Environment.NewLine
    End Sub

    Private Sub curDoc_ShapeMove(Shape As Shape) Handles curDoc.ShapeMove
        EventsTextBox.Text += "Shape Move" + Environment.NewLine
    End Sub

    Private Sub curDoc_ShapeTransform(Shape As Shape) Handles curDoc.ShapeTransform
        EventsTextBox.Text += "Shape Transform" + Environment.NewLine
    End Sub

    Private Sub curDoc_SelectionChange() Handles curDoc.SelectionChange
        EventsTextBox.Text += "Selection Change" + Environment.NewLine
    End Sub
End Class
If you have questions just let me know, I will help where I can.

Happy Coding,

Attached Files
File Type: zip ShapeChangeExampleDocker.zip (58.3 KB, 225 views)

Last edited by shelbym; 04-09-2021 at 00:38.
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
Events in different colour??? bojtren Calendar Wizard 1 25-12-2010 17:00
Command Bar events lnfagf Macros/Add-ons 2 15-06-2010 18:08
ThisDocument Events mapcar Corel Photo-Paint VBA 1 16-08-2009 15:23
Just use events ! TheFez CorelDRAW/Corel DESIGNER VBA 0 06-06-2008 04:23
Are there Other Events in CorelDraw? Jon Lorber CorelDRAW/Corel DESIGNER VBA 2 10-08-2005 10:17

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

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