Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 复选框实验室_C#_Jquery_Checkbox_Jcheckbox - Fatal编程技术网

C# 复选框实验室

C# 复选框实验室,c#,jquery,checkbox,jcheckbox,C#,Jquery,Checkbox,Jcheckbox,我需要在我的c#应用程序中显示/隐藏带有复选框的labelLayer,但我有一个问题,当label显示(选中复选框)时,它不会在复选框未选中时隐藏 private void checkBox1_CheckedChanged(object sender, EventArgs e) { SharpMap.Layers.LabelLayer labelLayer = new SharpMap.Layers.LabelLayer("nom commune");

我需要在我的c#应用程序中显示/隐藏带有复选框的labelLayer,但我有一个问题,当label显示(选中复选框)时,它不会在复选框未选中时隐藏

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
    {

        SharpMap.Layers.LabelLayer labelLayer = new SharpMap.Layers.LabelLayer("nom commune");
        PostGIS quart_pos = new PostGIS("Server=localhost;Port=5432;User=postgres;Password=aaaaaa;Database=MiniProjet", "quartierr", "geom", "libelle");
        VectorLayer countriesLayer = new VectorLayer("quartier", quart_pos);
        labelLayer.DataSource = countriesLayer.DataSource;
        labelLayer.LabelColumn = "NAME";
        labelLayer.Style.CollisionDetection = true;
        labelLayer.Style.CollisionBuffer = new SizeF(10, 10);
        labelLayer.MultipartGeometryBehaviour =
        SharpMap.Layers.LabelLayer.MultipartGeometryBehaviourEnum.Largest;
        labelLayer.Style.Font = new Font(FontFamily.GenericSansSerif, 8);

        if (checkBox1.Checked == true)
        {
            labelLayer.Style.ForeColor = Color.Black;
            carte.Layers.Add(labelLayer);
            Refresh();
        }
        else if(checkBox1.Checked == false)
        {
            carte.Layers.Remove(labelLayer);
            Refresh();
        }

    }

你能给你正在使用的类添加一个链接吗?
SharpMap.Layers.LabelLayer
这太旧了,我都记不起来了,但我觉得它像是selectedLayer.ClearLabels();你能给你正在使用的类添加一个链接吗?
SharpMap.Layers.LabelLayer
这太旧了,我都记不起来了,但我觉得它像是selectedLayer.ClearLabels();