Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
示例#1
0
        private void changeLineAppearanceMenu_Click(object sender, EventArgs e)
        {
            if (controller.CanChangeLineAppearance() == CommandStatus.Enabled) {
                CourseAppearance appearance = controller.GetCourseAppearance();

                short colorOcadId;
                float c, m, y, k;
                bool purpleOverprint;
                FindPurple.GetPurpleColor(mapDisplay, appearance, out colorOcadId, out c, out m, out y, out k, out purpleOverprint);

                LinePropertiesDialog linePropertiesDialog = new LinePropertiesDialog(MiscText.ChangeLineAppearanceTitle, MiscText.ChangeLineAppearanceExplanation, CmykColor.FromCmyk(c, m, y, k), appearance);

                // Get the defaults for a new line.
                SpecialColor color;
                LineKind lineKind;
                bool showRadius;
                float lineWidth, gapSize, dashSize, cornerRadius;
                controller.GetChangableLineProperties(out showRadius, out color, out lineKind, out lineWidth, out gapSize, out dashSize, out cornerRadius);
                linePropertiesDialog.ShowRadius = showRadius;
                linePropertiesDialog.ShowLineKind = !showRadius;
                linePropertiesDialog.Color = color;
                linePropertiesDialog.LineKind = lineKind;
                linePropertiesDialog.LineWidth = lineWidth;
                linePropertiesDialog.GapSize = gapSize;
                linePropertiesDialog.DashSize = dashSize;
                linePropertiesDialog.CornerRadius = cornerRadius;

                DialogResult result = linePropertiesDialog.ShowDialog();

                if (result == DialogResult.OK) {
                    controller.ChangeLineAppearance(linePropertiesDialog.Color, linePropertiesDialog.LineKind, linePropertiesDialog.LineWidth, linePropertiesDialog.GapSize, linePropertiesDialog.DashSize, linePropertiesDialog.CornerRadius);
                }

                linePropertiesDialog.Dispose();
            }
        }
示例#2
0
        private void addRectangleMenu_Click(object sender, EventArgs e)
        {
            // Set the course appearance into the dialog
            CourseAppearance appearance = controller.GetCourseAppearance();

            // Get the correct default purple color to use.
            float c, m, y, k;
            bool purpleOverprint;
            short ocadId;
            FindPurple.GetPurpleColor(mapDisplay, appearance, out ocadId, out c, out m, out y, out k, out purpleOverprint);

            LinePropertiesDialog linePropertiesDialog = new LinePropertiesDialog(MiscText.AddRectangleTitle, MiscText.AddRectangleExplanation, CmykColor.FromCmyk(c, m, y, k), appearance);

            // Get the defaults for a new line.
            SpecialColor color;
            LineKind lineKind;
            float lineWidth, gapSize, dashSize, cornerRadius;
            controller.GetLineSpecialProperties(SpecialKind.Rectangle, false, out color, out lineKind, out lineWidth, out gapSize, out dashSize, out cornerRadius);
            linePropertiesDialog.ShowRadius = true;
            linePropertiesDialog.ShowLineKind = false;
            linePropertiesDialog.Color = color;
            linePropertiesDialog.LineKind = LineKind.Single;
            linePropertiesDialog.LineWidth = lineWidth;
            linePropertiesDialog.GapSize = gapSize;
            linePropertiesDialog.DashSize = dashSize;
            linePropertiesDialog.CornerRadius = cornerRadius;

            DialogResult result = linePropertiesDialog.ShowDialog();

            if (result == DialogResult.OK) {
                controller.BeginAddRectangleSpecialMode(linePropertiesDialog.Color, linePropertiesDialog.LineKind, linePropertiesDialog.LineWidth, linePropertiesDialog.GapSize, linePropertiesDialog.DashSize, linePropertiesDialog.CornerRadius);
            }

            linePropertiesDialog.Dispose();
        }