小编GOP*_*DAV的帖子

"对象不支持IE中的属性或方法'find'"

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    <script>

        $(document).ready(function () {


            var data = [{
                "Id": "SWE",
                "Country": "Sweden",
                "Population": 9592552
            }, {
                "Id": "NOR",
                "Country": "Norway",
                "Population": 5084190
            }];


            function display(e) {
                alert("E" + e);
                var countryData = data.find(function (element, index, array) {
                    return element.Id === e;
                });
                alert(countryData.Population);
            }
            display('SWE');


        });


    </script>
</head>
</html>
Run Code Online (Sandbox Code Playgroud)

上面发布的代码在Firefox和Chrome上正常运行,但我在Internet Explorer中收到错误.错误信息:

Object doesn't support property or method 'find'

javascript c# internet-explorer visual-studio

63
推荐指数
5
解决办法
7万
查看次数

在Windows窗体中切换开关控件

我正在设计一个Toggle Switch控件CheckBox,但是目前我的控件只画了一个圆圈.如何绘制如下图像的圆形图形,如何根据控件的值更改圆的位置以表示已检查和未检查的状态,如下图所示:

在此输入图像描述

这是我的代码:

public class MyCheckBox:CheckBox
{
    public MyCheckBox()
    {
        this.Appearance = System.Windows.Forms.Appearance.Button;
        this.BackColor = Color.Transparent;
        this.TextAlign = ContentAlignment.MiddleCenter;
        this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
        this.FlatAppearance.BorderColor = Color.RoyalBlue;
        this.FlatAppearance.BorderSize = 2;
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        this.OnPaintBackground(e);
        using (var path = new GraphicsPath())
        {
            var c = e.Graphics.ClipBounds;
            var r = this.ClientRectangle;
            r.Inflate(-FlatAppearance.BorderSize, -FlatAppearance.BorderSize);
            path.AddEllipse(r);
            e.Graphics.SetClip(path);
            base.OnPaint(e);
            e.Graphics.SetClip(c);
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            if (this.Checked)
            {
                using (var p = new Pen(FlatAppearance.BorderColor,
                                       FlatAppearance.BorderSize))
                {
                    e.Graphics.DrawEllipse(p, r);
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# checkbox winforms toggleswitch

3
推荐指数
1
解决办法
1万
查看次数

Windows窗体中的圆形RadioButton列表

我使用jquery 插件和html 在Web应用程序中设计了循环按钮列表.在这个设计用户中,一次只选择一个单选按钮列表.设计如下所示:

在此输入图像描述

如何在Windows窗体中实现相同的设计和功能?请帮助我,从我开始实现这一目标.

.net c# user-controls gdi+ winforms

1
推荐指数
1
解决办法
552
查看次数