Commit 1afba36f 刘韬

1

1 个父辈 176e4433
......@@ -95,7 +95,7 @@ namespace PrintLabel_Test
MessageBox.Show(msg);
}
else
MessageBox.Show("连接成功");
MessageBox.Show("连接成功,dpi:"+ zebraManger.PrinterDPI);
}
private void button5_Click(object sender, EventArgs e)
......
......@@ -48,6 +48,15 @@ namespace ZebraPrinterHelper
{
try
{
if (string.IsNullOrEmpty(ConnectionEndpoint)) {
var dl = GetUsbDirectAddress();
if (dl.Count == 0)
{
new Exception("没有找到打印机");
}
ConnectionEndpoint = dl.First().Key;
}
return new UsbConnection(ConnectionEndpoint);
}
catch (Exception e)
......@@ -161,8 +170,8 @@ namespace ZebraPrinterHelper
try
{
ZebraImageI image = ZebraImageFactory.GetImage(bmp);
var width = image.Width * (PrinterDPI/203f);
var height = image.Height * (PrinterDPI / 203f);
var width = image.Width; // * (PrinterDPI/203f);
var height = image.Height; // * (PrinterDPI / 203f);
printer.PrintImage(image, 0, 0, (int)width, (int)height, false);
return true;
}
......@@ -208,6 +217,7 @@ namespace ZebraPrinterHelper
status = GetStatus();
if (status == null)
{
Close();
ReTryCount++;
if (ReTryCount > 3)
{
......
......@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E4F7AFC7-2F6D-4685-8350-3C05697428EA}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<RootNamespace>ZebraPrinterHelper</RootNamespace>
<AssemblyName>ZebraPrinterHelper</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
......@@ -33,6 +33,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="SdkApi.Core">
<HintPath>..\Source\Sdk\SdkApi.Core.dll</HintPath>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!