Example #1
0
        private void DrawFace(IntPtr hDC, int state)
        {
            IntPtr hCompatibleDC = UnsafeNativeMethods.CreateCompatibleDC(hDC);

            UnsafeNativeMethods.SelectObject(hCompatibleDC, MineCommon.FaceHBitmap);
            UnsafeNativeMethods.StretchBlt(hDC, cx / 2 - 12, 16, 24, 24, hCompatibleDC, 0, 24 * state, 24, 24, NativeMethods.SRCCOPY);
            MineCommon.Draw3DRectangle(hDC, cx / 2 - 13, 15, 26, 26, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_DARKGRAY);
            UnsafeNativeMethods.DeleteDC(hCompatibleDC);
        }
Example #2
0
 private void DrawFrame(IntPtr hDC)
 {
     MineCommon.FillRectangle(hDC, 0, 0, cx, 3, MineCommon.COLOR_WHITE);
     MineCommon.FillRectangle(hDC, 0, 0, 3, cy, MineCommon.COLOR_WHITE);
     MineCommon.Draw3DRectangle(hDC, 9, 9, cx - 14, 37, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
     MineCommon.Draw3DRectangle(hDC, 10, 10, cx - 16, 35, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
     MineCommon.Draw3DRectangle(hDC, 9, 52, cx - 14, cy - 57, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
     MineCommon.Draw3DRectangle(hDC, 10, 53, cx - 16, cy - 59, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
     MineCommon.Draw3DRectangle(hDC, 11, 54, cx - 18, cy - 61, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
 }
Example #3
0
        private void DrawPalette(IntPtr hDC)//用双缓冲
        {
            IntPtr hCompatibleDC     = UnsafeNativeMethods.CreateCompatibleDC(hDC);
            IntPtr hCompatibleBitmap = UnsafeNativeMethods.CreateCompatibleBitmap(hDC, cx, cy);

            UnsafeNativeMethods.SelectObject(hCompatibleDC, hCompatibleBitmap);
            MineCommon.FillRectangle(hCompatibleDC, 0, 0, cx, cy, MineCommon.COLOR_GRAY);
            DrawFace(hCompatibleDC, emotionState);
            DrawMineNumber(hCompatibleDC);
            DrawFrame(hCompatibleDC);
            DrawMineRectangle(hCompatibleDC);
            UnsafeNativeMethods.BitBlt(hDC, 0, 0, cx, cy, hCompatibleDC, 0, 0, NativeMethods.SRCCOPY);
            UnsafeNativeMethods.DeleteObject(hCompatibleBitmap);
            UnsafeNativeMethods.DeleteDC(hCompatibleDC);
        }
Example #4
0
        private void menuItemColor_Click(object sender, EventArgs e)
        {
            int index = render.GetImageIndex(menuItemColor);

            if (index == 5)
            {
                setting.AllowColor = false;
                index += 1;
            }
            else
            {
                setting.AllowColor = true;
                index -= 1;
            }
            render.SetImageIndex(menuItemColor, index);
            MineCommon.LoadBitmap(setting);
            minePalette.Invalidate();
        }
Example #5
0
        private void DrawMineNumber(IntPtr hDC)
        {
            IntPtr hCompatibleDC = UnsafeNativeMethods.CreateCompatibleDC(hDC);

            UnsafeNativeMethods.SelectObject(hCompatibleDC, MineCommon.NumberHBitmap);
            MineCommon.Draw3DRectangle(hDC, 16, 15, 41, 25, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
            MineCommon.Draw3DRectangle(hDC, cx - 55, 15, 41, 25, MineCommon.COLOR_DARKGRAY, MineCommon.COLOR_WHITE);
            int number = 0;

            number = (remaindMine < 0) ? 11 : remaindMine / 100;
            UnsafeNativeMethods.StretchBlt(hDC, 17, 16, 13, 23, hCompatibleDC, 0, 276 - 23 * (number + 1), 13, 23, NativeMethods.SRCCOPY);
            number = (remaindMine < 0) ? -(remaindMine - number * 100) / 10 : (remaindMine - number * 100) / 10;
            UnsafeNativeMethods.StretchBlt(hDC, 30, 16, 13, 23, hCompatibleDC, 0, 276 - 23 * (number + 1), 13, 23, NativeMethods.SRCCOPY);
            number = (remaindMine < 0) ? -remaindMine % 10 : remaindMine % 10;
            UnsafeNativeMethods.StretchBlt(hDC, 43, 16, 13, 23, hCompatibleDC, 0, 276 - 23 * (number + 1), 13, 23, NativeMethods.SRCCOPY);
            number = spendTime / 100;
            UnsafeNativeMethods.StretchBlt(hDC, cx - 55, 16, 13, 23, hCompatibleDC, 0, 276 - 23 * (number + 1), 13, 23, NativeMethods.SRCCOPY);
            number = (spendTime - number * 100) / 10;
            UnsafeNativeMethods.StretchBlt(hDC, cx - 42, 16, 13, 23, hCompatibleDC, 0, 276 - 23 * (number + 1), 13, 23, NativeMethods.SRCCOPY);
            number = spendTime % 10;
            UnsafeNativeMethods.StretchBlt(hDC, cx - 29, 16, 13, 23, hCompatibleDC, 0, 276 - 23 * (number + 1), 13, 23, NativeMethods.SRCCOPY);
            UnsafeNativeMethods.DeleteDC(hCompatibleDC);
        }
Example #6
0
 private void useHelp_Click(object sender, EventArgs e)
 {
     MineCommon.ShowHelp();
 }
Example #7
0
 private void aboutMine_Click(object sender, EventArgs e)
 {
     MineCommon.MineAbout("2012");
 }