question

GiacomoRaucci-0763 avatar image
0 Votes"
GiacomoRaucci-0763 asked JackJJun-MSFT edited

Converting VBA to VS 2019 Winform C#; however, the Designer's ToolBox does not list InkPicture

I am in the process of converting a VBA app to Visual Studio WinForm C#; however, the ToolBox InkPicture Control is not listed in the Toolbox. The MS web-site for Tablet PCs lists the steps to add the InkPicture control (https://docs.microsoft.com/en-us/windows/win32/tablet/adding-ink-controls-to-a-project); however, those steps do not work for a non-touchscreen laptop that I am using for development. Do I need to move the Visual Studio Winform development S/W to a touchscreen laptop so that the InkControl is listed from the Toolbox? Or is it something else?

On a separate note, I wish to thank cooldadtx for his reply to my questions to "Winform C# equivalent methods to VBA UserForm_Initialize ande Userform_Activate. Thanks for the help.

dotnet-csharpoffice-vba-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered

Right click on the ToolBox, add controls, search for the Ink library and add it and if not found you need to look at WPF using one of these packages.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
0 Votes"
Castorix31 answered Castorix31 commented

You can add it from COM Components, InkObj.dll :
(I tested on my Windows 10 OS, not a Tablet PC, and it works (with the mouse...))

162954-inkobj.jpg




inkobj.jpg (238.6 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the steps provided, I was able to select "Microsoft InkPicture Control" from the COM components, but I got the following message "The following controls were successsfully added to the toolbox but are not enabled in the active designer." And at the bottom, the message "Make sure the controls to add are compatible with the current Framework designer and .NET version.". So, I need to do some other steps since I did not see the InkPicture control in the Toolbox listed items. Suggestions?

0 Votes 0 ·
Castorix31 avatar image Castorix31 GiacomoRaucci-0763 ·

It adds this message if you created a .NET Core project, instead of a .NET Framework project

You must create a .NET Framework project, like this one selected :
162957-net-framework-project.jpg




0 Votes 0 ·
GiacomoRaucci-0763 avatar image
0 Votes"
GiacomoRaucci-0763 answered Castorix31 commented

With Visual Studio 2019, its unclear which project to select. Since I unsuccessfully tried via changing the .csproj, I wish to make sure that I select the correct project template. Please advise.

163261-image.png



image.png (51.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I posted a screencopy with the right project to choose yesterday in comment above (VS 2019 too)

0 Votes 0 ·
GiacomoRaucci-0763 avatar image
0 Votes"
GiacomoRaucci-0763 answered Castorix31 commented

Yes, I saw the screen capture from yesterday, that is why my follow-up. Not sure what version of VS 2019 that shows a difference. Your screen capture selection is "Windows Forms App (.NET Framework). I do not show that in my version: It lists the following:
(a) ASP.NET Web Application (.NET Framework)
(b) Windows Forms App
(c) ASP.NET Core Empty
(d) ASP.NET Core Web API
(e) Windows Forms Control Library (.NET Framework)

Since I'm creating a Windows-based App, its not clear whether I should select (a), (b) or (e). Since I'm not creating a Web App, I assume its not (a). So, is it (b) or (e)? Not trying to be difficult, I'm just trying not to redo things again. Thanks for your understanding in this matter. If I need to download the latest version of VS 2019 (asssuming I don't have the latest version), I can do that as well. Please advise. And thanks again.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

None of them
You must install the .Net Desktop development templates with Visual Studio Installer to get "Windows Forms App (.NET Framework)" and others

0 Votes 0 ·
GiacomoRaucci-0763 avatar image
0 Votes"
GiacomoRaucci-0763 answered

Ok, making progress, thanks for all of your help. I copied all 25 WinForms from 1 project to the newly created project (as you've directed). Although I was able to create the InkPicture control in my WinForm (I actually use InkPicture in 2 of the 25 WinForms). I'm now getting an Exception when attempting to load the WinForm that contains the InkPicture control. The Exception message is "ActiveX control nnn cannot be instantiated" where "nnn" is a long hex number. Searching the internet did not help much. Any ideas? And thanks in advance.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.