![]() |
#1
|
|||
|
|||
![]()
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?
|
#2
|
||||
|
||||
![]()
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: For those who do not want to download the zip the main code looks like this: Code:
Imports Corel.Interop.VGCore Public Class DockerUI Dim WithEvents corelApp As Application Dim WithEvents curDoc As Document Public Sub New(app As Object) InitializeComponent() 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 Happy Coding, -Shelby Last edited by shelbym; 04-09-2021 at 00:38. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |