云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C#调用把BarTender模板

C#调用把BarTender模板

  • 62 次阅读
  • 3 次下载
  • 2025/7/13 7:57:14

}

returnm_engine; } }

// Implement IDisposable public void Dispose() {

// The engine only needs to be stopped and disposed if it was // created. Use the field here, not the property. Otherwise, // you might create a new instance in the Dispose method! if (m_engine != null) {

// Stop the process and release Engine field resources. m_engine.Stop(); m_engine.Dispose(); } }

// Additional methods for specific work in your application. All additional

// methods should use the BtEngine property instead of the m_engine field. } In VB:

Public ClassEngineWrapper ImplementsIDisposable ' Engine Field

Privatem_engineAs Engine = Nothing

' This property will create and start the engine the first time it is ' called. Most methods in this class (and methods in child classes) ' should utilize this property instead of the m_engine field. Protected ReadOnly PropertyBtEngine() As Engine Get

' If the engine has not been created yet, create and start it. Ifm_engineIs Nothing Then m_engine = NewEngine(True) End If

Returnm_engine End Get End Property

' ImplementIDisposable

Public SubDispose() ImplementsIDisposable.Dispose

' The engine only needs to be stopped and disposed if it was ' created. Use the field here, not the property. Otherwise, ' you might create a new instance in the Dispose method! Ifm_engineIsNot Nothing Then

' Stop the process and release Engine field resources. m_engine.Stop() m_engine.Dispose() End If End Sub

' Additional methods for specific work in your application. All additional ' methods should use the BtEngine property instead of the m_engine field.

End Class

The class above provides lazy instantiation of an Engine object and a method for disposal of its resources. By using the BtEngine property for all work in its methods, this class will avoid creating and starting a BarTender process until it really needs one. This class offers a means of releasing its resources, its underlying Engine object, by implementing the IDisposable interface. If this class were used in a real application, it would include other methods that did work specific to the application. This code would be a reasonable base class for a hierarchy of classes that perform printing in a real application. In the case where instances of this class are intended to be used from multiple threads in an application, locking logic should be added to the BtEngine property to ensure the engine is only created once.

How To: Display the BarTender User Interface

By default, an Engine object's BarTender process runs BarTender in the background without being seen by a user. However, there may be times you will want to view and interact with BarTender抯 user interface. The following example shows how to view BarTender抯 users interface using the Engine.Window.Visible property. In C#:

using (EnginebtEngine = newEngine()) {

btEngine.Start();

btEngine.Window.Visible = true; // Application-specific code btEngine.Stop(); } In VB:

UsingbtEngineAs NewEngine() btEngine.Start()

btEngine.Window.Visible = True

' Application-specific code btEngine.Stop() End Using

In the above code, a new Engine is initialized and started. The BarTender application window is then shown by setting the Engine.Window'sVisible property to true. The method assumes some intervening work is done. Finally, the engine is stopped and automatically disposed when leaving the 'using' statement. If this code is run without any intervening work between the call to btEngine.Window.Visible and the btEngine.Stop method, the BarTender window will only flash open for a moment, then immediately close when the engine is stopped and the BarTender process is shutdown.

The Engine Class and Print Job Events

The Engine class provides many engine-wide events. Most of these, such as the JobQueued or JobSent, are used to monitor the status of a print job.

These same events are found in the LabelFormatDocument class, where they are specific to that label format. Unlike the events found in

LabelFormatDocument, Engine events provide a means to oversee print job events for all label formats opened by the engine.

For more information, refer to Working with Print Job Status Events. Printing Label Formats

A label format can be printed by calling the LabelFormatDocument'sPrint method. The Print method prints a job to a printer's spooler and returns a Result enumeration value. It can either return immediately after spooling the print job or wait to return until printing is complete. The LabelFormatDocument object contains several overloads for the Print method to assist in label printing.

? ? ? ?

Print()

Print(string printJobName)

Print(string printJobName, out Messages message)

Print(string printJobName, int waitForCompletionTimeout)

搜索更多关于: C#调用把BarTender模板 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

} returnm_engine; } } // Implement IDisposable public void Dispose() { // The engine only needs to be stopped and disposed if it was // created. Use the field here, not the property. Otherwise, // you might create a new instance in the Dispose method! if (m_engine != null) { // Stop the process and release Engine field resources. m_engine.Stop(); m_engine.Dis

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com