简体   繁体   English

Compact Framework 3.5 应用程序丢失字体样式

[英]Compact Framework 3.5 App Loses Font Styles

I have a basic Compact Framework v3.5 application running on Zebra MC2180 mobile barcode scanners and have a very intermittent issue.我有一个在 Zebra MC2180 移动条码扫描器上运行的基本 Compact Framework v3.5 应用程序,并且有一个非常间歇性的问题。

Occasionally (after approx 1 in 20 or so scans), all font styles set on all labels, buttons, etc are lost and revert to the default size 9 font.有时(在大约 20 次扫描中大约 1 次之后),所有标签、按钮等上设置的所有字体样式都会丢失并恢复为默认的 9 号字体。 Any specific "bold" settings or font sizes are lost.任何特定的“粗体”设置或字体大小都将丢失。

No exceptions are thrown, there is no indication anything has gone wrong except the missing font styles....没有抛出任何异常,除了缺少字体样式外,没有任何迹象表明出现任何问题....

If I write a trace on the font style property, when the font info is lost, I get a System.Drawing exception but no further information.如果我在字体样式属性上写一个跟踪,当字体信息丢失时,我会收到 System.Drawing 异常但没有更多信息。 It seems to me it is trying to access an unset property?在我看来,它正在尝试访问未设置的属性? Eg:例如:

System.Diagnostics.Trace.WriteLine(btn_orderChecking.Font.Style);

Produces (very intermittently):产生(非常间歇性):

A first chance exception of type 'System.Exception' occurred in System.Drawing.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type 'System.Exception' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Symbol.Barcode2.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
The program '[0x2C50F9A] MC2180.exe: Managed' has exited with code 0 (0x0).

The method producing the error is below.产生错误的方法如下。 This code snippet takes a barcode and displays product info (pulled from a web service)此代码段采用条形码并显示产品信息(从网络服务中提取)

case PANEL_PLU:案例 PANEL_PLU:

                        clearPLUpanel();
                        pluDataPartno.Text = "LOADING"; // This never gets seen - panel doesn't get repainted
                        lblScanBarcode.Hide();
                        panelError.Hide();

                        payload = new Dictionary<String, String>();
                        payload.Add("barcode", scanData.Text);
                        request = new dataRequest("plu",payload);
                        res = dataTransfer.sendRequest(request);

                        if (res.result == "ok")
                        {
                            // We're good, populate and show fields
                            playHappyBeep();
                            pluItem_Id = res.item_id;
                            pluDataPartno.Text = res.item_partno;
                            pluDataName.Text = res.item_name;
                            pluDataFreeStock.Text = res.item_freeStock.ToString();
                            pluDatalAllocated.Text = res.allocated_stock.ToString();
                            pluDataLoc.Text = res.loc_name;
                            pluDataShelfStock.Text = res.item_shelfStock.ToString();
                            pluLabelAllocated.Show();
                            pluLabelFreeStock.Show();
                            pluLabelLoc.Show();
                            pluLabelShelfStock.Show();
                            pluImage.Show();
                            plu_btnChangeLoc.Show();
                            plu_btnAutoLocate.Show();

                            if (res.image_url.StartsWith("http")) {
                                 pluImage.Url = new System.Uri(res.image_url);
                            }

                            if (res.item_freeStock > 0)
                            {
                                pluDataFreeStock.ForeColor = Color.Green;
                            }
                            else
                            {
                                pluDataFreeStock.ForeColor = Color.Red;
                            }

                        }
                        else
                        {
                            playErrorBeep();
                            clearPLUpanel();
                            lblErrorHeadline.Text = res.error_info;
                            panelError.Show();                               
                        }

                        System.Diagnostics.Trace.WriteLine(btn_orderChecking.Font.Style); // This is the line that occasionally throws the exception

                        break;

This error does not occur in OS version 82.34.004.在操作系统版本 82.34.004 中不会发生此错误。 You should to update OS to this version.您应该将操作系统更新到此版本。 Ondřej翁德耶

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM