错误CS0266无法将类型'system.windows.forms.progressbarstyle'隐式转换为'metroframework.metrocolorstyle'。存在显式转换(您是否错过了演员?) [英] Error CS0266 cannot implicitly convert type 'system.windows.forms.progressbarstyle' to 'metroframework.metrocolorstyle'. An explicit conversion exists (are you missing a cast? )

查看:360
本文介绍了错误CS0266无法将类型'system.windows.forms.progressbarstyle'隐式转换为'metroframework.metrocolorstyle'。存在显式转换(您是否错过了演员?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用MetroFrameworks表单和Progressbar制作程序,我需要在运行一些代码之后将样式从Continues切换到Marquee并且(progressBar = ProgressBarStyle.Marquee)不能工作





So i am making a program using MetroFrameworks forms and Progressbar and i need to switch the style from Continues to Marquee after some code is ran and (progressBar = ProgressBarStyle.Marquee) dosen't work


private void WebClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                this.DialogResult = DialogResult.No;
                this.Close();
            }
            else if (e.Cancelled)
            {
                this.DialogResult = DialogResult.Abort;
                this.Close();
            }
            else
            {
                lblProgress.Text = "Verifying Download...";
    ------->    progressBar.Style =  ProgressBarStyle.Marquee;    <---------

                bgWorker.RunWorkerAsync(new string[] { this.tempFile, this.md5 });
            }





我的尝试:





What I have tried:

progressBar.Style = ProgressBarStyle.Marquee;

推荐答案

引用:

错误CS0266无法将类型'system.windows.forms.progressbarstyle'隐式转换为'metroframework.metrocolorstyle'。存在显式转换(您是否缺少演员?)

Error CS0266 cannot implicitly convert type 'system.windows.forms.progressbarstyle' to 'metroframework.metrocolorstyle'. An explicit conversion exists (are you missing a cast? )

第一步

阅读文档:编译器错误CS0266 | Microsoft Docs [ ^ ]

第二步

了解类型转换(显式和隐式)......

Finaly

应用你的知识!

First step
Read the documentation: Compiler Error CS0266 | Microsoft Docs[^]
Second step
Learn about type casting (explicit and implicit)...
Finaly
Apply your knowledge!


样式 [ ^ ]属性是 MetroColorStyle [ ^ ]值, ProgressBarStyle 值。



你在寻找对于 ProgressBarStyle [ ^ ]属性:

The Style[^] property is a MetroColorStyle[^] value, not a ProgressBarStyle value.

You're looking for the ProgressBarStyle[^] property:
progressBar.ProgressBarStyle = ProgressBarStyle.Marquee;


这篇关于错误CS0266无法将类型'system.windows.forms.progressbarstyle'隐式转换为'metroframework.metrocolorstyle'。存在显式转换(您是否错过了演员?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆