创建 C# 应用程序来配置打印机页面设置
我希望在我的工作场所部署 ac# 应用程序,该应用程序定义默认纸张尺寸。没什么特别的。它的工作原理是调用 windows.win32 并使用注册表类写入注册表。
尽管我尽了最大努力,但我仍然无法找到相关的注册表项来设置纸张尺寸和注册打印机。有人可以帮忙吗?
干杯!
I am looking to deploy a c# application at my workplace which defines the default paper size. Nothing too special. It works by calling windows.win32 and using the registry class to write to the registry.
Despite my best efforts, I have been unable to find the relevant registry entries in order to set the paper size and registered printers. Can anyone help?
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不支持更改注册表设置。
正确的方法是使用
DEVMODE
结构。DocumentProperties 底部的备注
函数描述了将新设置(例如纸张尺寸)与现有配置合并的正确方法。不要担心它描述了如何更改应用程序的设置。将最后一步 (
CreateDC
) 替换为调用SetPrinter
函数位于 级别 8 更改其全局默认值打印机(或使用级别 9 更改每个用户的默认设置)。在 C++ 中这样做会容易得多,因为您可以使用 Windows 提供的头文件。所涉及的结构非常复杂,获得正确的 p/invoke 定义将非常困难。
Changing registry settings is not the supported way to do this.
The correct way is to use the
DEVMODE
structure.The remarks at the bottom of the
DocumentProperties
function describe the correct way to merge a new setting (such as paper size) with the existing configuration.Don't worry that it describes how to change the settings for your application. Replace the last step (
CreateDC
) with calling theSetPrinter
function at level 8 to change the global defaults for that printer (or use level 9 to change the per-user defaults).Doing this would be much easier in C++, since you can use the Windows-provided header files. The structures involved are very complex, and getting the right p/invoke definitions would be extremely difficult.
更改打印机参数的常用方法是通过 Win32 <打印过程中的code>DEVMODE结构。驱动程序本身负责填写默认值,并且通常通过其属性页进行配置。
The usual way to change printer parameters is through the Win32
DEVMODE
structure during the printing process. The driver itself is responsible for filling in the defaults, and is generally configured through its property page.我认为您想要的设置不存在。
我找到了这个
http://www.pcreview.co.uk/forums/settings-dafault-paper-size-registry-t528995.html
I dont think that the settings you want exist.
I found this
http://www.pcreview.co.uk/forums/settings-dafault-paper-size-registry-t528995.html