2010-02-01 39 views
2

我無法設置PosPritnter類的屬性。例如PageModeStation,PageModeVerticalPosition,PageModePrintArea等POS for .NET:無法設置PosPrinter的屬性屬性

PosPrinter posPrinter = (PosPrinter)posExplorer.CreateInstance(posPrinterInfo); 
posPrinter.Open(); 
posPrinter.Claim(1000); 
posPrinter.DeviceEnabled = true; 
posPrinter.PageModeVerticalPosition = 10; //<--- Exception thrown: Failed to set property PageModeVerticalPosition 

異常詳細信息:

Microsoft.PointOfService.PosControlException was unhandled 
    Message="Failed to set property PageModeVerticalPosition." 
    Source="Microsoft.PointOfService" 
    ErrorCodeExtended=0 
    StackTrace: 
      at Microsoft.PointOfService.Legacy.LegacyProxy.SetProperty(String propertyName, Object propertyValue) 
      at Microsoft.PointOfService.Legacy.LegacyPosPrinter.set_PageModeVerticalPosition(Int32 value) 
     .... 

有什麼建議?

回答

0

假設打印機支持的話,你可能需要: 1 - 啓用頁面模式

posPrinter.PageModePrint(PageModePrintControl.PageMode); 

2 - 定義打印區域。

posPrinter.PageModePrintArea = new Rectangle(0, 0, posPrinter.PageModeArea.X, posPrinter.PageModeArea.Y); 

嘗試設置該屬性之前。

+0

你可以請檢查我的問題在這裏http://stackoverflow.com/questions/12408057/pos-for-net-print-formatting-cant-use-escape-character-char27#comment16677149_12408057我似乎無法得到Microsoft POSPrinter Simulator具有任何形式的格式(粗體,文本對齊等)。不適用於我的實際POS打印機。 – 2012-09-13 15:14:50