Exemple #1
0
        public static void DrawRoundRect(Graphics g, int x, int y, int width, int height, RoundRectColors colors)
        {
            IntPtr hdc = g.GetHdc();
            const int ROUND_SIZE = 3; //3*3�s�N�Z���͎��O�ŕ`��
            IntPtr pen = Win32.CreatePen(0, 1, colors.border_color);
            Win32.SelectObject(hdc, pen);
            //��
            Win32.MoveToEx(hdc, x + ROUND_SIZE, y);
            Win32.LineTo(hdc, x + width - ROUND_SIZE + 1, y);
            //��
            Win32.MoveToEx(hdc, x + ROUND_SIZE, y + height);
            Win32.LineTo(hdc, x + width - ROUND_SIZE + 1, y + height);
            //��
            Win32.MoveToEx(hdc, x, y + ROUND_SIZE);
            Win32.LineTo(hdc, x, y + height - ROUND_SIZE + 1);
            //�E
            Win32.MoveToEx(hdc, x + width, y + ROUND_SIZE);
            Win32.LineTo(hdc, x + width, y + height - ROUND_SIZE + 1);

            Win32.DeleteObject(pen);

            DrawRoundCorner(hdc, x, y, 1, 1, colors); //����
            DrawRoundCorner(hdc, x + width, y, -1, 1, colors); //�E��
            DrawRoundCorner(hdc, x, y + height, 1, -1, colors); //����
            DrawRoundCorner(hdc, x + width, y + height, -1, -1, colors); //�E��

            g.ReleaseHdc(hdc);
        }
Exemple #2
0
        public static void DrawRoundRect(Graphics g, int x, int y, int width, int height, RoundRectColors colors) {
            IntPtr hdc = g.GetHdc();
            const int ROUND_SIZE = 3; //3*3ピクセルは自前で描画
            IntPtr pen = Win32.CreatePen(0, 1, colors.border_color);
            Win32.SelectObject(hdc, pen);
            //上
            Win32.MoveToEx(hdc, x + ROUND_SIZE, y);
            Win32.LineTo(hdc, x + width - ROUND_SIZE + 1, y);
            //下
            Win32.MoveToEx(hdc, x + ROUND_SIZE, y + height);
            Win32.LineTo(hdc, x + width - ROUND_SIZE + 1, y + height);
            //左
            Win32.MoveToEx(hdc, x, y + ROUND_SIZE);
            Win32.LineTo(hdc, x, y + height - ROUND_SIZE + 1);
            //右
            Win32.MoveToEx(hdc, x + width, y + ROUND_SIZE);
            Win32.LineTo(hdc, x + width, y + height - ROUND_SIZE + 1);

            Win32.DeleteObject(pen);

            DrawRoundCorner(hdc, x, y, 1, 1, colors); //左上
            DrawRoundCorner(hdc, x + width, y, -1, 1, colors); //右上
            DrawRoundCorner(hdc, x, y + height, 1, -1, colors); //左下
            DrawRoundCorner(hdc, x + width, y + height, -1, -1, colors); //右下

            g.ReleaseHdc(hdc);
        }
Exemple #3
0
 //�z��̎Q�Ƃɉ�]���������Ă���̂ɒ���
 private static void DrawRoundCorner(IntPtr hdc, int bx, int by, int dx, int dy, RoundRectColors colors)
 {
     int y = by;
     for (int j = 0; j < 3; j++) {
         int x = bx;
         for (int i = 0; i < 3; i++) {
             Win32.SetPixel(hdc, x, y, colors.GetColor(_round_border_info[i, j]));
             x += dx;
         }
         y += dy;
     }
 }