專案描述:數字樓宇對講管理機,我用門口機呼叫管理機,管理機接聽或者直接掛斷后回傳到主視窗,主視窗會有黑線,不能完美繪制。我在掛斷點處用invalidaterect和updatewindow函式沒有解決?求指導!
uj5u.com熱心網友回復:
主視窗會有黑線,不能完美繪制。——這個要分析代碼。黑線是怎么來的,要分析一下。
uj5u.com熱心網友回復:
case WM_PAINT:mwforceNCpaint = TRUE;
printf("paint1\n");
/* repaint lower windows before alpha blending this window*/
++hwnd->unmapcount; /* tricky don't clip this window*/
SendMessage(rootwp, WM_PAINT, 0, 0);
for(sibwp=hwnd->siblings; sibwp; sibwp=sibwp->siblings)
SendMessage(sibwp, WM_PAINT, 0, 0);
--hwnd->unmapcount;
/* then queue repaint for higher windows*/
for(sibwp=hwnd->parent->children; sibwp != hwnd;
sibwp=sibwp->siblings)
/* don't paint if already painted by above code*/
if(sibwp->paintSerial != mwpaintSerial)
PostMessage(sibwp, WM_PAINT, 0, 0);
/* now paint this window offscreen and blend with screen*/
hdc=BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* redirect painting to offscreen dc*/
hdcMem = CreateCompatibleDC(ps.hdc);
hbmp = CreateCompatibleBitmap(hdcMem, rect.right, rect.bottom);
hbmpOrg = SelectObject(hdcMem, hbmp);
/* paint window to offscreen*/
hbr = (HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND);
FillRect(hdcMem, &rect, hbr);
//SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT));
SetBkMode(hdcMem, TRANSPARENT);
DEBUG("flag_connect is %d\n",flag_connect);
oldfont=SelectObject(hdc,font_chinese);
SetBkColor(hdc, RGB(100,149,237));
if(flag_connect == 0)
{
//hdc=BeginPaint(hwnd,&ps);
//GetClientRect(hwnd,&rect);
// SetTextColor(hdc, 0x004060a0);
//jimmy +++ set text color
// SetBkColor(hdc, RGB(255,00,00));
printf("paint2\n");
for(num_time=0;num_time<9;num_time++)
{
// fgets(buf_log,sizeof(buf_log),fp_log);
SetRect(&rect_log[num_time],20,150+32*num_time,20+200,150+20+32*num_time);
DrawText(hdc," ", -1, &rect_log[num_time], DT_WORDBREAK );
}
for(num_time=0;num_time<9;num_time++)
{
SetRect(&rect_right[num_time],540,150+32*num_time,540+80,150+20+32*num_time);
DrawText(hdc," ", -1, &rect_right[num_time], DT_WORDBREAK );
}
// DEBUG("tm.tmHeight is %d tm.tmAveCharWidth is %d\n",tm.tmHeight,tm.tmAveCharWidth);
//SetRect(&rect,20,150,20+200,150+ 20);
printf("paint3\n");
DrawText(hdc, "歡迎使用躍天樓宇對講", -1, &rect_log[0],
DT_WORDBREAK );
cur_time(buf_showtime);
SetRect(&rect_top, 10,20+80,10+500,10+40);
DrawText(hdc,buf_showtime, -1, &rect_top, DT_WORDBREAK );
edit=CreateWindowEx(0L, "EDIT",
"",
WS_BORDER|WS_CHILD | WS_VISIBLE,//WS_VISIBLE,WS_DISABLED
10, 10, 500, 80,
hwnd, (HMENU)200, NULL, NULL);
//EndPaint(hwnd,&ps);
}
mydc=GetDC(hwnd);
DrawDIB(mydc, 570, 15, &image_logo);
ReleaseDC(hwnd,mydc);
DeleteObject(SelectObject(hdcMem, hbmpOrg));
DeleteDC(hdcMem);
//EndPaint(hwnd,&ps);//
printf("paint4\n");
break;
uj5u.com熱心網友回復:
這是他們寫的重繪函式,if陳述句在重繪時不執行,你幫我看看uj5u.com熱心網友回復:
怎么覺得是WINDOWS編程?uj5u.com熱心網友回復:
我接手的專案,在windows 端source insight里面寫的轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/140406.html
標籤:嵌入開發(WinCE)
