Example #1
0
        private void panelDBLayerList_Paint(object sender, PaintEventArgs e)
        {
            PanelCustom panel          = (PanelCustom)sender;
            Point       mousePoint     = panel.PointToClient(Cursor.Position);
            int         fieldRows      = panel.Height / this.FontHeight;
            int         rowHeight      = this.FontHeight;
            int         index          = GetCurrentLayerIndex();
            int         highlightIndex = mousePoint.Y / this.FontHeight;
            int         start          = vScrollBarMapLayerList.Value;

            if (tileMap.layerList.Count <= 0)
            {
                return;
            }

            if (index >= 0)
            {
                e.Graphics.FillRectangle(Brushes.PowderBlue, 0, rowHeight * (index - start), panelCustomLayerList.Width, rowHeight);
            }

            if (highlightIndex + start < tileMap.layerList.Count)
            {
                if (mousePoint.X > 0 && mousePoint.X < panelCustomLayerList.Width - 3)
                {
                    if (mousePoint.Y > 0 && mousePoint.Y < panelCustomLayerList.Height - 3)
                    {
                        e.Graphics.DrawRectangle(Pens.Blue, 0, rowHeight * highlightIndex, panel.Width, rowHeight);
                    }
                }
            }

            for (int i = 0; i < fieldRows; i++)
            {
                if (i >= tileMap.layerList.Count)
                {
                    return;
                }

                string   info     = "MapLayer: " + (i + start).ToString();
                CheckBox checkBox = mapLayerCheckBoxes[i + start];
                checkBox.Location = new Point(panel.Width - checkBox.Width, rowHeight * i);

                e.Graphics.DrawString(info, this.Font, Brushes.Black, 0, rowHeight * i);
            }
        }
Example #2
0
        private void panelDBTileLibList_Paint(object sender, PaintEventArgs e)
        {
            PanelCustom panel          = (PanelCustom)sender;
            Point       mousePoint     = panel.PointToClient(Cursor.Position);
            int         fieldRows      = panel.Height / this.FontHeight;
            int         rowHeight      = this.FontHeight;
            int         index          = GetCurrentTileLibIndex();
            int         highlightIndex = mousePoint.Y / this.FontHeight;
            int         start          = vScrollBarTileLibList.Value;

            if (tileLibs.Count <= 0)
            {
                return;
            }

            if (index >= 0)
            {
                e.Graphics.FillRectangle(Brushes.PowderBlue, 0, rowHeight * (index - start), panelCustomTileLibList.Width, rowHeight);
            }

            if (highlightIndex + start < tileLibs.Count)
            {
                if (mousePoint.X > 0 && mousePoint.X < panelCustomTileLibList.Width - 3)
                {
                    if (mousePoint.Y > 0 && mousePoint.Y < panelCustomTileLibList.Height - 3)
                    {
                        e.Graphics.DrawRectangle(Pens.Blue, 0, rowHeight * highlightIndex, panel.Width, rowHeight);
                    }
                }
            }

            for (int i = 0; i < fieldRows; i++)
            {
                if (i >= tileLibs.Count)
                {
                    return;
                }

                e.Graphics.DrawString("TileLib: " + (i + start), this.Font, Brushes.Black, 0, rowHeight * i);
            }
        }