private void btnImplant_Click(object sender, EventArgs e)
        {
            Button           button = _teeth[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex];
            ToothStatusFlags flags  = _flags[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex];

            if (flags == ToothStatusFlags.Implant)
            {
                _flags[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex] = ToothStatusFlags.Normal;
            }
            else if (flags == ToothStatusFlags.Normal)
            {
                _flags[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex] = ToothStatusFlags.Implant;
            }

            RenderTooth();
        }
        private void btnKopruSola_Click(object sender, EventArgs e)
        {
            Button           button = _teeth[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex];
            ToothStatusFlags flags  = _flags[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex - 1];

            if (flags == ToothStatusFlags.Hidden)
            {
                _flags[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex - 1] = ToothStatusFlags.Bridge;
            }
            else if (flags == ToothStatusFlags.Bridge)
            {
                _flags[_lastSelectedToothVerticalPosition][_lastSelectedToothIndex - 1] = ToothStatusFlags.Hidden;
            }

            RenderTooth();
        }
        private void RenderTooth()
        {
            SaveTeethMap();

            _lines = new List <Point[]>();

            foreach (var row in _teeth)
            {
                for (int i = 0; i < row.Value.Length; i++)
                {
                    Button           button = row.Value[i];
                    ToothStatusFlags flags  = _flags[row.Key][i];

                    string imageName = button.AccessibleName
                                       .Replace("TOP", "U")
                                       .Replace("BOTTOM", "L")
                                       .Replace("LEFT", "R")
                                       .Replace("RIGHT", "L")
                                       .Replace("_", "");

                    button.BackgroundImage = Image.FromFile("images/" + imageName + ".jpg");
                    button.Text            = string.Empty;

                    switch (flags)
                    {
                    case ToothStatusFlags.Hidden:
                        button.BackgroundImage = Image.FromFile("images/NULL.jpg");;
                        break;

                    case ToothStatusFlags.Normal:
                        break;

                    case ToothStatusFlags.Bridge:
                        button.Visible         = true;
                        button.BackgroundImage = Image.FromFile("images/bridge.jpg");

                        Button btnLeft  = row.Value[i - 1];
                        Button btnRight = row.Value[i + 1];

                        Point p1 = btnLeft.Location;
                        p1.X += btnLeft.Width / 2;

                        Point p2 = p1;
                        p2.Y -= 10;

                        Point p4 = btnRight.Location;
                        p4.X += btnRight.Width / 2;

                        Point p3 = p4;
                        p3.Y -= 10;

                        _lines.Add(new Point[] { p1, p2, p3, p4 });

                        break;

                    case ToothStatusFlags.Filling:
                        button.Text      = "D";
                        button.ForeColor = Color.Green;
                        button.Font      = new Font(button.Font, FontStyle.Bold);
                        button.TextAlign = row.Key == ToothVerticalPosition.TOP
                                ? ContentAlignment.BottomCenter
                                : ContentAlignment.TopCenter;

                        break;

                    case ToothStatusFlags.Implant:
                        Image imageImplant = Image.FromFile("images/implant.jpg");

                        if (row.Key == ToothVerticalPosition.TOP)
                        {
                            imageImplant.RotateFlip(RotateFlipType.RotateNoneFlipY);
                        }

                        button.BackgroundImage = imageImplant;

                        break;
                    }
                }
            }

            tabControl1.Invalidate();
        }