//BOOL OnEraseBkgnd(CDC* pDC) //{ // return TRUE; //} private void DialogMessage_Paint(object sender, PaintEventArgs e) { CDC dc = new CDC(); dc.SetGraphics(e.Graphics); // device context for painting //获取位置 CRect rcClient = new CRect(); GetClientRect(ref rcClient); //创建缓冲 CDC DCBuffer = new CDC(); CBitmap ImageBuffer = new CBitmap(); ImageBuffer.CreateCompatibleBitmap(dc, rcClient.Width(), rcClient.Height()); DCBuffer.CreateCompatibleDC(ImageBuffer); //设置 DC //DCBuffer.SetBkMode(TRANSPARENT); //DCBuffer.SelectObject(&ImageBuffer); DCBuffer.SelectObject(m_InfoFont); DCBuffer.SetTextAlign(CDC.TA_TOP | CDC.TA_LEFT); DCBuffer.SetTextColor(Color.FromArgb(250, 250, 0)); m_ImageBackdrop.BitBlt(DCBuffer.GetSafeHdc(), 0, 0); string szInfo = string.Empty; DCBuffer.DrawText(m_szMessage, rcClient, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_CENTER); //绘画界面 dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), ImageBuffer, 0, 0, 0); //清理资源 //DCBuffer.SetTextColor(oldColor); //DCBuffer.SetTextAlign(nTextAlign); //DCBuffer.SelectObject(oldBitmap); //DCBuffer.SelectObject(oldFont); //DCBuffer.DeleteDC(); //ImageBuffer.DeleteObject(); }
//BOOL OnEraseBkgnd(CDC* pDC) //{ // return true; //} private void DialogBetRecord_Paint(object sender, PaintEventArgs e) { CDC dc = new CDC(); dc.SetGraphics(e.Graphics); //获取位置 CRect rcClient = new CRect(); GetClientRect(ref rcClient); //创建缓冲 CDC DCBuffer = new CDC(); CBitmap ImageBuffer = new CBitmap(); ImageBuffer.CreateCompatibleBitmap(dc, rcClient.Width(), rcClient.Height()); DCBuffer.CreateCompatibleDC(ImageBuffer); //设置 DC //DCBuffer.SetBkMode(TRANSPARENT); //DCBuffer.SelectObject(&ImageBuffer); DCBuffer.SelectObject(m_InfoFont); DCBuffer.SetTextAlign(CDC.TA_TOP | CDC.TA_LEFT); DCBuffer.SetTextColor(Color.FromArgb(250, 250, 0)); m_ImageBackdrop.BitBlt(DCBuffer.GetSafeHdc(), 0, 0); //绘画界面 dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), ImageBuffer, 0, 0, 0); //清理资源 //DCBuffer.SetTextColor(oldColor); //DCBuffer.SetTextAlign(nTextAlign); //DCBuffer.SelectObject(oldBitmap); //DCBuffer.SelectObject(oldFont); //DCBuffer.DeleteDC(); //ImageBuffer.DeleteObject(); }
//BOOL OnEraseBkgnd(CDC* pDC) //{ // return TRUE; //} private void DialogStatistics_Paint(object sender, PaintEventArgs e) { CDC dc = new CDC(); dc.SetGraphics(e.Graphics); //获取位置 CRect rcClient = new CRect(); GetClientRect(ref rcClient); //创建缓冲 CDC DCBuffer = new CDC(); CBitmap ImageBuffer = new CBitmap(); ImageBuffer.CreateCompatibleBitmap(dc, rcClient.Width(), rcClient.Height()); DCBuffer.CreateCompatibleDC(ImageBuffer); //设置 DC //DCBuffer.SetBkMode(TRANSPARENT); //CBitmap* oldBitmap = DCBuffer.SelectObject(&ImageBuffer); DCBuffer.SelectObject(m_InfoFont); DCBuffer.SetTextAlign(CDC.TA_TOP | CDC.TA_LEFT); DCBuffer.SetTextColor(Color.FromArgb(250, 250, 255)); //背景 m_ImageBackdrop.BitBlt(DCBuffer.GetSafeHdc(), 0, 0); //线 CPoint point = new CPoint(); point.SetPoint(51, 284); for (int i = 0; i < HorseDefine.HORSES_ALL; ++i) { for (int j = 0; j < m_nWinCount[i]; ++j) { m_ImageLine.BitBlt(DCBuffer.GetSafeHdc(), point.x, point.y); point.y -= 1; } string szInfo = string.Empty; CRect rect = new CRect(); rect.SetRect(point.x - 2, point.y - 15, point.x + 17, point.y); szInfo = m_nWinCount[i].ToString(); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_CENTER); point.x += 21; point.y = 284; } //绘画界面 dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), ImageBuffer, 0, 0, 0); //清理资源 //DCBuffer.SetTextColor(oldColor); //DCBuffer.SetTextAlign(nTextAlign); //DCBuffer.SelectObject(oldBitmap); //DCBuffer.SelectObject(oldFont); //DCBuffer.DeleteDC(); //ImageBuffer.DeleteObject(); }
// CDialogMessage 消息处理程序 public override bool OnInitDialog() { Control hInstance = this; //m_ImageBackdrop.LoadFromResource( hInstance,Properties.Resources.BACK_MESSAGE ); SetWindowPos(null, 0, 0, m_ImageBackdrop.GetWidth(), m_ImageBackdrop.GetHeight(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOMOVE); //m_btDetermine.SetButtonImage( Properties.Resources.BT_MESSAGE, hInstance , false , false); //m_btClosee.SetButtonImage( Properties.Resources.BT_CLOSE, hInstance , false , false); CRect rcButton = new CRect(); m_btDetermine.GetWindowRect(ref rcButton); m_btDetermine.MoveWindow(m_ImageBackdrop.GetWidth() / 2 - rcButton.Width() / 2, m_ImageBackdrop.GetHeight() - 50, rcButton.Width(), rcButton.Height()); m_btClosee.MoveWindow(m_ImageBackdrop.GetWidth() - 26, 1, 25, 25); return(true); }
void OnBnClickedButton100w() { m_lTheNote = 100; m_btBet1000.MoveWindow(m_rcBet1000); m_btBet1W.MoveWindow(m_rcBet1W); m_btBet10W.MoveWindow(m_rcBet10W); m_btBet100W.MoveWindow(m_rcBet100W.left, m_rcBet100W.top - 5, m_rcBet100W.Width(), m_rcBet100W.Height()); }
//BOOL OnEraseBkgnd(CDC* pDC) //{ // return true; //} private void DialogRecord_Paint(object sender, PaintEventArgs e) { CDC dc = new CDC(); dc.SetGraphics(e.Graphics); //获取位置 CRect rcClient = new CRect(); GetClientRect(ref rcClient); //创建缓冲 CDC DCBuffer = new CDC(); CBitmap ImageBuffer = new CBitmap(); ImageBuffer.CreateCompatibleBitmap(dc, rcClient.Width(), rcClient.Height()); DCBuffer.CreateCompatibleDC(ImageBuffer); //设置 DC //DCBuffer.SetBkMode(TRANSPARENT); //CBitmap* oldBitmap = DCBuffer.SelectObject(&ImageBuffer); DCBuffer.SelectObject(m_InfoFont); DCBuffer.SetTextAlign(CDC.TA_TOP | CDC.TA_LEFT); DCBuffer.SetTextColor(Color.FromArgb(250, 250, 255)); //背景 m_ImageBackdropHand.BitBlt(DCBuffer.GetSafeHdc(), 0, 0); int nBcakY = m_ImageBackdropHand.GetHeight(); for (int i = 0; i < HorseDefine.MAX_SCORE_HISTORY; ++i) { m_ImageBackdrop.BitBlt(DCBuffer.GetSafeHdc(), 0, nBcakY); nBcakY += m_ImageBackdrop.GetHeight(); } m_ImageBackdropTail.BitBlt(DCBuffer.GetSafeHdc(), 0, nBcakY); //写记录 int nRecordsY = m_ImageBackdropHand.GetHeight(); string szInfo = string.Empty; CRect rect = new CRect(); for (int i = 0; i < m_GameRecords.Count; ++i) { rect.SetRect(0, nRecordsY, 28, nRecordsY + 15); szInfo = m_GameRecords[i].nStreak.ToString(); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_CENTER); rect.SetRect(28, nRecordsY, 57, nRecordsY + 15); szInfo = IdentifyAreas(m_GameRecords[i].nRanking); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_CENTER); rect.SetRect(57, nRecordsY, 86, nRecordsY + 15); szInfo = m_GameRecords[i].nRiskCompensate.ToString(); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_CENTER); rect.SetRect(86, nRecordsY, 151, nRecordsY + 15); szInfo = string.Format("{0}{1}:{2}{3}:{4}{5}", m_GameRecords[i].nHours >= 10 ? TEXT("") : TEXT("0"), m_GameRecords[i].nHours, m_GameRecords[i].nMinutes >= 10 ? TEXT("") : TEXT("0"), m_GameRecords[i].nMinutes, m_GameRecords[i].nSeconds >= 10 ? TEXT("") : TEXT("0"), m_GameRecords[i].nSeconds); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_CENTER); nRecordsY += 15; } nRecordsY = m_szTotalSize.cy - 85; rect.SetRect(5, nRecordsY, 146, nRecordsY + 15); szInfo = string.Format("本局总投注:{0}", m_lAllBet); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_LEFT); nRecordsY += 15; rect.SetRect(5, nRecordsY, 146, nRecordsY + 15); szInfo = string.Format("本局投注人数:{0}", m_lBetMumber); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_LEFT); nRecordsY += 20; rect.SetRect(5, nRecordsY, 146, nRecordsY + 15); szInfo = string.Format("您的余额为:{0}", m_lPlayerScore); DCBuffer.DrawText(szInfo, rect, CDC.DT_SINGLELINE | CDC.DT_END_ELLIPSIS | CDC.DT_VCENTER | CDC.DT_LEFT); //绘画界面 dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), ImageBuffer, 0, 0, 0); //清理资源 //DCBuffer.SetTextColor(oldColor); //DCBuffer.SetTextAlign(nTextAlign); //DCBuffer.SelectObject(oldBitmap); //DCBuffer.SelectObject(oldFont); //DCBuffer.DeleteDC(); //ImageBuffer.DeleteObject(); }