简体   繁体   中英

printing a Windows user control form

I am working on a project for printing the layout I create using a user control form.

I have my printer setup and everything. However, what I essentially want to do is to use the coordinates of the elements.

How can I access the elements of the user control form inside my project and assign the value of the fields accordingly?

I have two namespaces in my project 1. Display the user control form as Windows desktop application - MyForm 2. Interacts with printer and fetch data from the database. MyForm.Core

MyForm is the application and MyForm.Core is implemented as a library. Please let me know how I can access the user form on MyForm namespace in MyForm.Core?

I included the MyForm namespace in the printer.cs

using MyForm;

And tried to get an object of the User Form Layout.cs as:

var layoutObj = new Layout();

But the Layout is not included and shows its not found. Alternatively, I tried including MyForm namespace.

using MyForm;

and tried

var layoutObj = new MyForm();

but Visual studio shows me a message MyForm is a namespace but is used like a type.

Please help!

I found the solution.

I moved the user control under the MyForm.Core NameSpace and now can access it without problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM