各位兄台,帮帮我啊。
搞了一天,都没有搞定。火死了。
搞了一天,都没有搞定。火死了。
解决方案 »
- Panel中的CalendarExtender显示位置问题
- 导出excel速度优化
- 网站在点击调转到另一个页面时弹出一个页面锁定原来页面
- 引用javascript文件 引用绝对地址时引发的错误:
- 全部分都给你了,怎么样获得SELECT count(name) FROM score的结果? 在线等,急!!!!
- 存储过程里的统计,如何赋值?.....如下
- 如何引用类(asp.net2.0)
- .NET空间低价出售!!!!!!!!!!
- gridview无法更新数据
- 关于load事件下的一个小问题
- IIS6建立.*通配符应用程序映射的问题
- Selection.InlineShapes.AddPicture 图片大小怎么设置 ----ASP.NET操作WORD插入图片--急急急急急
Public Sub Printing(printer As String)
Try
streamToPrint = New StreamReader(filePath)
Try
printFont = New Font("Arial", 10)
Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf pd_PrintPage
' Specify the printer to use.
pd.PrinterSettings.PrinterName = printer If pd.PrinterSettings.IsValid then
pd.Print()
Else
MessageBox.Show("Printer is invalid.")
End If
Finally
streamToPrint.Close()
End Try
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
using System.DirectoryServices;
using System.Runtime.InteropServices;
using activeds; // Import activeds.tlb interop assembly
/********************************************************************************
// needs a reference to the interop assembly generated by tlbimp.exe
// Compile with csc /r:activeds.dll adprinter.cs
********************************************************************************/class Tester {
// Printer status flags - see SDK docs for status values (IADsPrintQueueOperations)
[Flags]
enum PrinterStatus {
Paused = 1,
DeletePending = 2,
Error = 3,
PaperJam = 4,
PaperOut = 5
}
public static void Main() {
DirectoryEntry printer = new DirectoryEntry("WinNT://servername/printqueuename", null, null, AuthenticationTypes.ServerBind);
Console.WriteLine(printer.Path);
PropertyCollection pcoll = printer.Properties;
try
{
foreach(string sc in pcoll.PropertyNames) {
Console.WriteLine(sc + ":\t" + (pcoll[sc])[0].ToString());
} Console.WriteLine("---------------------------------");
}
catch(COMException ex)
{
Console.WriteLine(ex.Message);
}
// Use the PrintqueueOperations interface to contol the printer Queue
IADsPrintQueueOperations po = printer.NativeObject as IADsPrintQueueOperations ;
if(po != null) {
if(po.Status == (int)PrinterStatus.Paused) // If paused resume else pause printer
po.Resume();
else
po.Pause();
// Use the IADsPrintJob to control individual printjobs
foreach(IADsPrintJob pj in po.PrintJobs()) {
Console.WriteLine("{0} - {1}", pj.Description, pj.Name);
IADsPrintJobOperations pjo = pj as IADsPrintJobOperations;
Console.WriteLine(pjo.Name);
// Use IADsPrintJob.Name as arg. to remove the job from the queue
po.PrintJobs().Remove(pj.Name);
}
} printer.Dispose();
}
}
/********************************************************************************
// needs a reference to the interop assembly generated by tlbimp.exe
// Compile with csc /r:activeds.dll adprinter.cs
********************************************************************************/
这里的具体操作怎么个实现法?
adprinter.cs哪里有?
DirectoryEntry printer = new DirectoryEntry( "WinNT://servername/printqueuename ",null, null, AuthenticationTypes.ServerBind);
这个是什么?我是XP的系统。