Binding Enumerate and RadioButton

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
Hi there:
Im trying to bind enum and radioButton. What I want to do is to plot the Mesh when my radioButton is checked.


<div style="color:Black;background-color:White; <pre>
        <span style="color:Blue; public <span style="color:Blue; enum PlotChoice
        {
            UndeformedNodes,
            DeformedNodes,
            Mesh,
            DisplacementVectors,
            Contour,
        }

        <span style="color:Blue; private <span style="color:Blue; void glControl1_Paint(<span style="color:Blue; object sender, PaintEventArgs e)
        {
            PlotChoice myPlot = PlotChoice.Mesh;

            <span style="color:Blue; if (myPlot == PlotChoice.UndeformedNodes) <span style="color:Green; // Plotting the undeformed nodes
            {
                GL.PointSize(3);
                GL.Color3(Color.Black);
                GL.Begin(BeginMode.Points);

                <span style="color:Blue; foreach (<span style="color:Blue; var vertex <span style="color:Blue; in coordinates)
                {
                    GL.Vertex3(vertex);
                }

                GL.End();
            }

            <span style="color:Blue; else <span style="color:Blue; if (myPlot == PlotChoice.Mesh) <span style="color:Green; // Plotting the mesh
            {
                GL.LineWidth(1f);
                GL.Color3(Color.Green);
                GL.Begin(BeginMode.Lines);

                <span style="color:Blue; for (<span style="color:Blue; int i = 0; i < a.Mesh.ElementConnectivityList.Count(); i++)
                {
                    GL.Vertex3(elementConnectivity0.ElementAt(i));
                    GL.Vertex3(elementConnectivity1.ElementAt(i));

                    GL.Vertex3(elementConnectivity0.ElementAt(i));
                    GL.Vertex3(elementConnectivity2.ElementAt(i));

                    GL.Vertex3(elementConnectivity0.ElementAt(i));
                    GL.Vertex3(elementConnectivity3.ElementAt(i));

                    GL.Vertex3(elementConnectivity1.ElementAt(i));
                    GL.Vertex3(elementConnectivity2.ElementAt(i));

                    GL.Vertex3(elementConnectivity1.ElementAt(i));
                    GL.Vertex3(elementConnectivity3.ElementAt(i));

                    GL.Vertex3(elementConnectivity2.ElementAt(i));
                    GL.Vertex3(elementConnectivity3.ElementAt(i));
                }

                GL.End();
            }
        }

        <span style="color:Blue; private <span style="color:Blue; void radioButton_CheckedChanged(<span style="color:Blue; object sender, EventArgs e)
        {
            <span style="color:Green; // code here
        }
[/code]
Thank you for your help!
Aditya







View the full article
 
Back
Top