Ejemplo n.º 1
0
        private void createMyCursor()
        {
            int dia = (int)(strokeThicknessLogical * Scale);

            if ((dia / 2) * 2 != dia)
            {
                dia += 1;
            }
            Rectangle rect = new Rectangle(0, 0, 5 * dia + 1, 5 * dia + 1);

            using (Bitmap bmp = new Bitmap(rect.Width, rect.Height))
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    Color bgCol = Color.FromArgb(0, 255, 255, 255);
                    using (Brush b = new SolidBrush(bgCol))
                    {
                        g.FillRectangle(b, 0, 0, bmp.Width, bmp.Height);
                    }
                    g.SmoothingMode = SmoothingMode.HighQuality;
                    Color col = Color.Gray;
                    using (Brush b = new SolidBrush(col))
                    {
                        Rectangle dotRect = new Rectangle(2 * dia, 2 * dia, dia, dia);
                        g.FillEllipse(b, dotRect);
                    }
                    using (Pen p = new Pen(col))
                    {
                        g.DrawEllipse(p, dia + dia / 2, dia + dia / 2, 2 * dia, 2 * dia);
                    }
                    myCursor = CustomCursor.CreateCursor(bmp, 2 * dia + dia / 2, 2 * dia + dia / 2);
                }
        }