所以我得到了一个奇怪的错误......我按照一些步骤在我的WPF C#App中创建了一个CircularProgressBar。它在我的桌面上工作正常,它不在我的笔记本电脑上。
我创建了一个WindowsFormsHost并将循环进度条设为子项。然后我把它作为一个名为ProgressGrid的网格的子项。
无论如何,错误只是说“应用程序中的组件中出现了未处理的异常。如果单击继续,应用程序将忽略此错误”如果我点击继续关注您,它运行完全正常。
错误细节说“System.ArgumentException:参数无效”它继续列出我写的几乎所有东西。我认为这与Dispose()有关...... Heres the Code:
var SelectAll =
(from a in dc.GetTable<SR>()
select a).ToList();
int all = SelectAll .Count();
var ByGroup =
(from a in dc.GetTable<SR>()
where a.GroupID == GroupID
orderby a.ID
select a).ToList();
int SelectedGroup = ByGroup .Count();
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
CircularProgressBar.CircularProgressBar ProgressCircle = new CircularProgressBar.CircularProgressBar();
host.Child = ProgressCircle;
ProgressGrid.Children.Add(host);
if (ShallMarquee == 1 || FilterByThisDivision == TheEmployee.Division)
{
ProgressCircle.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
}
else
{
ProgressCircle.Style = System.Windows.Forms.ProgressBarStyle.Blocks;
}
ProgressCircle.MarqueeAnimationSpeed = 4000;
ProgressCircle.Text = Convert.ToString(NumOf + "%");
ProgressCircle.SubscriptText = "";
ProgressCircle.SuperscriptText = "";
ProgressCircle.Font = new Font("Arial", 22);
ProgressCircle.ProgressWidth = 10;
ProgressCircle.SuperscriptColor = System.Drawing.Color.Black;
ProgressCircle.ProgressColor = System.Drawing.ColorTranslator.FromHtml(MainColor);
System.Windows.Media.Color StandardBackgroundBlue = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(BackgroundColor);
var drawingcolor = System.Drawing.Color.FromArgb(StandardBackgroundBlue.A, StandardBackgroundBlue.R, StandardBackgroundBlue.G, StandardBackgroundBlue.B);
ProgressCircle.BackColor = drawingcolor;
ProgressCircle.InnerColor = drawingcolor;
ProgressCircle.OuterColor = System.Drawing.Color.LightGray;
ProgressCircle.ForeColor = System.Drawing.Color.Black;
ProgressCircle.Value = NumOf;
ProgressCircle.Maximum = TotalNum;
//END CIRCLE
现在,当我调整内容时,gridjust会显示一个字符串作为数字,以便您可以忽略它。我也读过一些关于GDI的内容,但我有点失落。
P.S。我应该注意它也说“无效参数”,它肯定不是。
P.P.S。我是在Windows 7 64位上开发的。我的笔记本电脑是Windows 10 64位。但它也不适用于我的兄弟Windows 7 64位。如果这有助于任何......