예제 #1
1
void TrayToolTipDlg::ApplyTransparencyAndBorder(CDC& dc)
{
	CRect rect;
	GetClientRect(&rect);
	//=== Draw the border
	CRect rcBorder(rect);
	dc.SelectStockObject(NULL_BRUSH);
	dc.SelectStockObject(DC_PEN);
	dc.SetDCPenColor(m_colors[COL_Border]);
	rcBorder.right--;
	rcBorder.bottom--;
	dc.RoundRect(&rcBorder, CPoint(9,9));

	//=== Clip the window region
	CRgn rgn;
	rgn.CreateRoundRectRgn(rect.left, rect.top, rect.right, rect.bottom, 9, 9);
	int err = dc.SelectClipRgn(&rgn, RGN_XOR);
	ASSERT(err != ERROR);

	//=== Draw Transparent background
	dc.FillSolidRect(&rect, m_colors[COL_Transparency]);
}
예제 #2
0
BOOL CBlendSelectWnd::DelItem(int nItem)
{
	if (!m_wndListBox.DeleteItem(nItem))
		return FALSE;

	// Resize 
	int nListBoxHeight = m_wndListBox.GetListHeight();
	m_dwHeight = m_dwMargin + m_dwTitleHeight + m_dwMargin + nListBoxHeight + m_dwMargin;

	CRgn CaptionRegion;
	CaptionRegion.CreateRoundRectRgn(0, 
		0, 
		m_dwWidth, 
		m_dwHeight, 
		10, 
		10);
	SetWindowRgn((HRGN)CaptionRegion.m_hObject, TRUE);

	int cxScreen = GetSystemMetrics(SM_CXSCREEN);
	int cyScreen = GetSystemMetrics(SM_CYSCREEN);

	SetWindowPos(NULL, 0, 0, m_dwWidth, m_dwHeight, SWP_NOMOVE | SWP_NOZORDER);

	// Set List Box Position
	int nBtnLeft = (m_hIcon == NULL) ? m_dwMargin : (m_dwMargin * 2 + 32);
	int nBtnWidth = (m_hIcon == NULL) ? (m_dwWidth - 2 * m_dwMargin) : (m_dwWidth - 3 * m_dwMargin - 32);
	int nButTop = 2 * m_dwMargin + m_dwTitleHeight;
	m_wndListBox.MoveWindow(nBtnLeft, nButTop, nBtnWidth, nListBoxHeight);

	Invalidate();

	return TRUE;
}
예제 #3
0
int CMovingLrcDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO:  在此添加您专用的创建代码
	MoveWindow(CRect(400,0,800,25));
	SetTimer(1,TIMER_INTERVAL,NULL);
	ipast=0.0f;
	m_Font.CreateFont(   
		12,    //nHeight   //_T("Tahoma")); 14
		0,                              //nWidth   
		0,    //nEscapement   
		0,    //nOrientation   
		FW_NORMAL,   //nWeight 
		//FW_MEDIUM,
		//FW_SEMIBOLD,
		FALSE,                          //bItalic   
		FALSE,                          //bUnderline   
		0,                              //cStrikeOut   
		//   ANSI_CHARSET,     
		DEFAULT_CHARSET,  //nCharSet   
		OUT_DEFAULT_PRECIS,             //nOutPrecision   
		CLIP_DEFAULT_PRECIS,            //nClipPrecision   
		DEFAULT_QUALITY,                //nQuality   
		DEFAULT_PITCH   |   FF_SWISS,   //nPitchAndFamily   
		_T("宋体"));
	SetWindowPos(&wndTopMost,400,0,0,0,SWP_NOSIZE);
	CRgn rgn;
	rgn.CreateRoundRectRgn(0,0,400,25,10,10);
	SetWindowRgn(rgn,TRUE);
	ShowWindow(SW_SHOW);
	UpdateWindow();
	return 0;
}
예제 #4
0
BOOL CIBALoginDlg::OnInitDialog()
{
	CIBADialog::OnInitDialog();

	LoadImage();
	
	SetEditFont();

	InitOperatorsCombo();
	GetDlgItem(IDC_COMBO_CASHIER)->SetFont(&m_Font);
	//设置登入框的位置
	if (m_nLoginType == 0)
	{//被覆盖窗体依然处于最顶端,但失去激活
		SetWindowPos(&CWnd::wndTopMost, 0, 0, 318, 242, SWP_NOMOVE);
		GetDlgItem(IDC_EDIT_PWD)->SetFocus();
	}
	else
	{//不做原设置,只移动新窗体
		SetWindowPos(NULL, 0, 0, 318, 242, SWP_NOMOVE);
		m_cboOperators.SetFocus();
	}

	CRgn MyRgn;
	MyRgn.CreateRoundRectRgn(0, 0, 318, 242, 12, 12);
	SetWindowRgn(MyRgn, FALSE);

	//{ 2011/09/05-8201-gxx: 
	m_btnEnmergency.ShowWindow(FALSE);
	WINDOWPLACEMENT wp;
	m_btnEnmergency.GetWindowPlacement(&wp);
	CString strAllCheckOut;
	m_btnEnmergency.GetWindowText(strAllCheckOut);
	m_btnAllCheckOut.Create( strAllCheckOut, WS_VISIBLE|WS_CHILD|SS_NOTIFY,wp.rcNormalPosition,this,IDC_BUTTON_ENMERGENCY);
	m_btnAllCheckOut.SetFont(&m_FontSmallBold);
	m_btnAllCheckOut.SetBkColor(RGB(245, 236, 216));
	m_btnAllCheckOut.SetLinkColor(RGB(218,186,129));
	m_btnAllCheckOut.SetHoverColor(RGB(235, 207, 156));
	m_btnAllCheckOut.SetVisitedColor(RGB(218, 186, 129));
	m_btnAllCheckOut.SetTransparent(FALSE);
	m_btnAllCheckOut.ShowWindow(CIBAConfig::GetInstance()->GetEnmergencyVisible());
	
	//}
	
	//m_btnEnmergency.ShowWindow(CIBAConfig::GetInstance()->GetEnmergencyVisible());

	
	//如果没有设置网吧ID或者识别码
	if (CNetBarConfig::GetInstance()->GetNetBarId() == 0 
		|| CNetBarConfig::GetInstance()->GetNetBarKey().GetLength() < 16)
	{
		CDlgNetbarConfig dlg;
		if (dlg.DoModal() == IDOK)
		{
			CNetBarConfig::GetInstance()->LoadFromDB();
		}
	}

	return FALSE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
예제 #5
0
void CLayeredDialog::SetLayeredDialog( HINSTANCE hInstance,LPCTSTR lpResource,CSize szSizeLT,CSize szSizeRB )
{
	//设置窗口
	RemoveBorder();

	//加载资源
	m_ImageBack.LoadImage(hInstance,lpResource);

	//设置大小
	CSize SizeWindow(m_ImageBack.GetWidth(),m_ImageBack.GetHeight());
	SetWindowPos(NULL,0,0,SizeWindow.cx,SizeWindow.cy,SWP_NOZORDER|SWP_NOMOVE|SWP_NOREDRAW);

	//获取窗口
	CRect rcWindow;
	GetWindowRect(&rcWindow);

	//计算位置
	CRect rcUnLayered;
	rcUnLayered.top=szSizeLT.cy;
	rcUnLayered.left=szSizeLT.cx;
	rcUnLayered.right=rcWindow.Width()-szSizeRB.cx;
	rcUnLayered.bottom=rcWindow.Height()-szSizeRB.cy;

	//设置区域
	CRgn RgnWindow;
	RgnWindow.CreateRoundRectRgn(rcUnLayered.left,rcUnLayered.top,rcUnLayered.right+1,rcUnLayered.bottom+1,0,0);

	//设置区域
	SetWindowRgn(RgnWindow,FALSE);

	//分层窗口
	m_LayeredWindow.CreateLayered(this,rcWindow);
	m_LayeredWindow.InitLayeredArea(m_ImageBack,255,rcUnLayered,CPoint(0,0),false);
}
예제 #6
0
void CFeedIcoItemListCtrl::DrawGroup(CDC & dcMem, const CRect & rectGroup, const CString & strGroupCaption, const CString & strGroupTotals)
{
	CRgn rgnFrame;//画圆角矩形
	rgnFrame.CreateRoundRectRgn( rectGroup.left, rectGroup.top, rectGroup.right, rectGroup.bottom, 3, 3 );

	if (m_imageRss_GroupBg)
	{
		m_imageRss_GroupBg->Draw(dcMem.m_hDC, rectGroup.left,  rectGroup.top, rectGroup.Width(),  24);
	}

	//CBrush* brushFrame; 
	//brushFrame = new CBrush( GetSysColor(COLOR_GRAYTEXT) );
	//dcMem.FrameRgn(&rgnFrame,brushFrame,1,1);//画焦点边框
	//delete brushFrame;

	CRect rectCaption  ( rectGroup.left + 7, rectGroup.top + 4, rectGroup.left + 40, rectGroup.bottom - 3   ) ;

	dcMem.SetTextColor( RGB(0,0,0) );
	dcMem.DrawText(strGroupCaption, -1, &rectCaption, DT_SINGLELINE|DT_LEFT/*|DT_CENTER*/ );

	CRect rectTotals  ( rectCaption.right + 4, rectGroup.top + 5, rectCaption.right + 80, rectGroup.bottom - 3   ) ;

	CFont * pListFont = GetFont();
	CFont* pOld = dcMem.SelectObject(pListFont);
	dcMem.SetTextColor( RGB(169,47,47) );
	dcMem.DrawText(strGroupTotals, -1, &rectTotals, DT_SINGLELINE|DT_LEFT/*|DT_CENTER*/ );
	dcMem.SelectObject(pOld);
}
예제 #7
0
void CEasySkinManager::OnSize( UINT nType, int cx, int cy )
{
    CEasySkinDialog::OnSize(nType, cx, cy);

    //移动准备
    HDWP hDwp=BeginDeferWindowPos(64);
    UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER;

    if ( m_enWndStyle != en_Wnd_None )
    {
        DeferWindowPos(hDwp,m_btClose,NULL,cx-41,0,0,0,uFlags|SWP_NOSIZE);

        if ( m_enWndStyle != en_Wnd_CloseBox )
        {
            if( m_enWndStyle != en_Wnd_MinimizeBox )
                DeferWindowPos(hDwp,m_btMax,NULL,cx-69,0,0,0,uFlags|SWP_NOSIZE);

            DeferWindowPos(hDwp,m_btMin,NULL,cx-69-(m_enWndStyle==en_Wnd_Normal?28:0),0,0,0,uFlags|SWP_NOSIZE);
        }
    }

    //结束调整
    //LockWindowUpdate();
    EndDeferWindowPos(hDwp);
    //UnlockWindowUpdate();

    //设置圆角
    CRgn rgn;
    rgn.CreateRoundRectRgn(0,0,cx,cy,4,4);
    SetWindowRgn(rgn,FALSE);

    //更新界面
    Invalidate(FALSE);
}
예제 #8
0
//绘制窗口边框
void CDBFrame::DrawBorder(CDC *pDC)
{
	CRect rcWindow;
	GetWindowRect(&rcWindow);
	rcWindow.OffsetRect(-rcWindow.left, -rcWindow.top);
	
	int iCaptionHeight = m_rcSysBorder.top + m_imageCaption.Height();
	m_imageBorders[LEFT].Render(pDC, CPoint(0, iCaptionHeight),
		CSize(m_rcSysBorder.left, rcWindow.Height() - iCaptionHeight));

	m_imageBorders[RIGHT].Render(pDC,
		CPoint(rcWindow.Width() - m_rcSysBorder.right, iCaptionHeight),
		CSize(m_rcSysBorder.right, rcWindow.Height() - iCaptionHeight));

	m_imageBorders[BOTTOM].Render(pDC,
		CPoint(0, rcWindow.Height() - m_rcSysBorder.bottom),
		CSize(rcWindow.Width(), m_rcSysBorder.bottom));

 	CRgn rgn;
 	CRect rcWnd;
	GetWindowRect(rcWnd);
	rcWnd.OffsetRect(-rcWnd.left, -rcWnd.top);
 	rgn.CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, 2,2);
	CBrush brush;
	brush.CreateSolidBrush(RGB(171,186,227));
	pDC->FrameRgn(&rgn, &brush, 1,1);


}
예제 #9
0
//重画函数
void CScoreView::OnPaint() 
{
	CPaintDC dc(this); 

	//设置 DC
	dc.SetBkMode(TRANSPARENT);
	dc.SetTextColor(RGB(255,255,255));
	dc.SelectObject(CSkinResourceManager::GetDefaultFont());

	//设置区域
	CRect rt;
	GetClientRect(&rt);
	CRgn WndRgn;
	WndRgn.CreateRoundRectRgn(rt.left,rt.top,rt.right,rt.bottom,10,10);
	SetWindowRgn(WndRgn,TRUE);
	WndRgn.DeleteObject();

	//绘画背景
	CImageHandle ImageHandle(&m_ImageBack);
	m_ImageBack.BitBlt(dc,0,0);

	//显示分数
	WORD wStation=0;
	TCHAR szBuffer[64]=TEXT("");
	CImageHandle HandleWinLose(&m_ImageWinLose);
	INT nWinLoseWidth = m_ImageWinLose.GetWidth()/3;
	INT nWinLostHeight = m_ImageWinLose.GetHeight();
	for (WORD i=0;i<CountArray(m_szUserName);i++)
	{
		if (m_szUserName[i][0]!=0)
		{
			//输出名字
			CRect rcName(28,wStation*29+79,117,(wStation+1)*29+79);
			dc.DrawText(m_szUserName[i],lstrlen(m_szUserName[i]),&rcName,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			//输出成绩
			CRect rcScore(117,wStation*29+79,182,(wStation+1)*29+79);
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_lScore[i]);
			dc.DrawText(szBuffer,lstrlen(szBuffer),&rcScore,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			//胜负标志
			BYTE byIndex = 0;
			if( m_lScore[i] == 0 ) byIndex = 2;
			else if( m_lScore[i] < 0 ) byIndex = 1;
			m_ImageWinLose.AlphaDrawImage(&dc,182+(253-182)/2-nWinLoseWidth/2,wStation*29+79+29/2-nWinLostHeight/2,nWinLoseWidth,nWinLostHeight,
				byIndex*nWinLoseWidth,0,RGB(255,0,255));

			//服务费用
			CRect rcService(253,wStation*29+79,321,(wStation+1)*29+79);
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_lGameTax[i]);
			dc.DrawText(szBuffer,lstrlen(szBuffer),&rcService,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			//设置变量
			wStation++;
		}
	}

	return;
}
예제 #10
0
   LRESULT CPanel::OnPaint(UINT, WPARAM,LPARAM,BOOL&)
   {
      CPaintDC dc(m_hWnd); 
      CRect r;
      GetClientRect(&r);
      
      CRgn rgn;
      HRGN oldRgn=NULL;
      if(roundCorners)
      {
          rgn.CreateRoundRectRgn(r.left,r.top,r.right,r.bottom,cornerParam.x,cornerParam.y);
          dc.SelectClipRgn(rgn);
      }

      if(m_hTheme == NULL || theme == FALSE)
      {
          if(enableGradient==FALSE)
            dc.FillSolidRect(&r,bkColor);
          else
            gradientRender.DrawGradient(dc,r,startColor,endColor,gradientType,transformationType);
      }
      else
        DrawThemeBackground(dc,TABP_BODY,0,&r,NULL);
        //DrawThemeBackground(dc,BP_PUSHBUTTON,0,&r,NULL);
      
      if(!caption.IsEmpty())
      {
         CFont oldFont=dc.SelectFont(font);
         COLORREF tc=dc.SetTextColor(textColor);
         int bkm=dc.SetBkMode(TRANSPARENT);
         dc.DrawText(caption,caption.GetLength(),r,vertAlign|horizAlign|singleLine);
         dc.SetTextColor(tc);
         dc.SetBkMode(bkm);
         dc.SelectFont(oldFont);
      }
      if(m_hTheme == NULL || theme == FALSE)
      {
          if(roundCorners==FALSE)
          {
            dc.DrawEdge(&r,inner|outer,edge);
          }
          else
          {
              dc.SelectClipRgn(NULL);
              CPen pen;
              HBRUSH oldBrush = dc.SelectStockBrush(NULL_BRUSH);
              pen.CreatePen(PS_INSIDEFRAME,1,borderColor);
              HPEN oldpen=dc.SelectPen(pen);
              dc.RoundRect(r,cornerParam);
              dc.SelectPen(oldpen);
              dc.SelectBrush(oldBrush);
          }
      }
      else
          DrawThemeEdge(dc,TABP_BODY,0,&r,inner|outer,edge);
          //DrawThemeEdge(dc,BP_PUSHBUTTON,0,&r,inner|outer,edge);

      return 0;
   }
예제 #11
0
BOOL CVisualManager::OnSetWindowRegion (CWnd* pWnd, CSize sizeWindow)
{
	ASSERT_VALID (pWnd);

	if (pWnd->GetSafeHwnd () == NULL)
	{
		return FALSE;
	}

	if (!CanDrawImage ())
	{
		return FALSE;
	}

	if (globalData.DwmIsCompositionEnabled ())
	{
		return FALSE;
	}

    CSize sz (0, 0);

	if (DYNAMIC_DOWNCAST (CBCGPFrameWnd, pWnd) != NULL)
	{
		if (pWnd->IsZoomed ())
		{
			pWnd->SetWindowRgn (NULL, TRUE);
			return TRUE;
		}

		sz  = CSize (9, 9);
	}

	if (sz != CSize (0, 0))
	{
        CRgn rgn;
		BOOL bCreated = FALSE;

		bCreated = rgn.CreateRoundRectRgn (0, 0, sizeWindow.cx + 1, sizeWindow.cy + 1, sz.cx, sz.cy);

		if (bCreated)
		{
			if (pWnd->IsKindOf (RUNTIME_CLASS (CMDIChildWnd)))
			{
				CRgn rgnWinodw;
				rgnWinodw.CreateRectRgn (0, sz.cy, sizeWindow.cx, sizeWindow.cy);

				rgn.CombineRgn (&rgn, &rgnWinodw, RGN_OR);
			}

			pWnd->SetWindowRgn ((HRGN)rgn.Detach (), TRUE);
			return TRUE;
		}
	}

	return FALSE;
}
예제 #12
0
void CMyBtn::ChangeWindowRgn(CDC *pDC)
{
	COLORREF col = RGB(255,0,255);
	CRect rcClient;
	GetClientRect (rcClient);
	CRgn rgn;
	rgn.CreateRoundRectRgn (0, 0, rcClient.Width(), rcClient.Height(),6,6);

	SetWindowRgn (rgn, TRUE);
}
/////////////////////////////////////////////////////////////////////
// 
// CXInfoTip::GetWindowRegion()
// 
// DESCRIPTION
//     
//		Retrieves the window region
//
// RETURNS
//
//		[BOOL]		- TRUE on success, FALSE on failure
//
// PARAMETERS
//
//		[pDC]		- Pointer to display device context
//		[hRegion]	- Filled with the calculated window region
//		[Size]		- Filled with the calculated window size
//					or NULL.
//     
/////////////////////////////////////////////////////////////////////
BOOL CXInfoTip::GetWindowRegion(CDC* pDC, HRGN* hRegion, CSize *Size /* = NULL */)
{
	CRect	rcWnd;
	POINT	ptLeader[3];
	CRgn	LeaderRegion;
	CRgn	CaptionRegion;
	CFont	*pSysFont;
	
	ASSERT(pDC != NULL);
	ASSERT(hRegion != NULL);

	// Calculate the are for the tip text
	pSysFont = (CFont *)pDC->SelectObject(m_pFont);
	pDC->DrawText(m_szText, &rcWnd, DT_CALCRECT);
	pDC->SelectObject(pSysFont);

	// Adjust for the rounded corners
	rcWnd.InflateRect(CX_ROUNDED, CY_ROUNDED);

	// Adjust for icon
	if (m_hIcon != NULL)
		rcWnd.right = rcWnd.right + m_IconSize.cx + CX_ICON_MARGIN;
	if (rcWnd.Height() < m_IconSize.cy)
		rcWnd.bottom = rcWnd.top + m_IconSize.cy;

	// Calculate the leader triangle coordinates

	ptLeader[0].x	= rcWnd.Width() - CX_ROUNDED;
	ptLeader[0].y	= rcWnd.Height() - CY_ROUNDED;

	ptLeader[1].x	= ptLeader[0].x;
	ptLeader[1].y	= ptLeader[0].y + CY_LEADER;

	ptLeader[2].x	= ptLeader[0].x - CX_LEADER;
	ptLeader[2].y	= rcWnd.Height() - CY_ROUNDED;

	// Create the caption region
	CaptionRegion.CreateRoundRectRgn(0, 0, rcWnd.Width(), rcWnd.Height(), CX_ROUNDED, CY_ROUNDED);
	// Create the leader region
	LeaderRegion.CreatePolygonRgn(ptLeader, 3, ALTERNATE);
	// Create window region
	*hRegion =  ::CreateRectRgn(0, 0, rcWnd.Width(), rcWnd.Height() + CY_LEADER);
	// Combine the regions
	CombineRgn(*hRegion, CaptionRegion.operator HRGN(), LeaderRegion.operator HRGN(), RGN_OR);

	// Set the window size
	if (Size != NULL)
	{
		Size->cx	= rcWnd.Width();
		Size->cy	= rcWnd.Height() + CY_LEADER;
	}

	return TRUE;
}
예제 #14
0
int CBlendSelectWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_dwTitleHeight = CalculateTitleHeight();

	int nBtnLeft = (m_hIcon == NULL) ? m_dwMargin : (m_dwMargin * 2 + 32);
	int nBtnWidth = (m_hIcon == NULL) ? (m_dwWidth - 2 * m_dwMargin) : (m_dwWidth - 3 * m_dwMargin - 32);
	int nButTop = 2 * m_dwMargin + m_dwTitleHeight;

	m_wndListBox.SetTextColor(m_crText);
	m_wndListBox.SetBkColor(m_crBkgnd);
	m_wndListBox.SetRadioIcon(m_hIconCheck, m_hIconUnCheck);

	m_wndListBox.SetFont(&m_ftOption);

	CRect rcListBox(nBtnLeft, nButTop, nBtnLeft + nBtnWidth, nButTop);
	if (!m_wndListBox.Create(rcListBox, this, 0, WS_CHILD | WS_VISIBLE|WS_VSCROLL, RLS_HAS_RADIO))
		return -1;

	m_dwHeight = m_dwMargin * 3 + m_dwTitleHeight + m_wndListBox.GetListHeight();

	CRgn CaptionRegion;
	CaptionRegion.CreateRoundRectRgn(0, 
		0, 
		m_dwWidth, 
		m_dwHeight, 
		10, 
		10);
	SetWindowRgn((HRGN)CaptionRegion.m_hObject, TRUE);

	if (m_dwAnimateDelay > 0) {
		m_wAlpha = 0;
		DWORD dwInterval = m_dwAnimateDelay / 16;
		::SetLayeredWindowAttributes(GetSafeHwnd(), 0, (BYTE)m_wAlpha, LWA_ALPHA);

		m_bAnimateInTimer = TRUE;
		SetTimer(TIMER_ID_ANIMATEIN, dwInterval, NULL);
	} else
	{
		m_wAlpha = 255;
		::SetLayeredWindowAttributes(GetSafeHwnd(), 0, (BYTE)m_wAlpha, LWA_ALPHA);

		if (m_dwShowDelay > 0) 
		{
			SetTimer(TIMER_ID_SHOW, m_dwShowDelay, NULL);
			m_bShowTimer = TRUE;
		}
	}

	return 0;
}
예제 #15
0
BOOL CScoreView::OnEraseBkgnd(CDC* pDC)
{
	//
	CRect rt;
	GetClientRect(&rt);
	CRgn WndRgn;
	WndRgn.CreateRoundRectRgn(rt.left,rt.top,rt.right+1,rt.bottom+1,10,10);
	SetWindowRgn(WndRgn,TRUE);
	WndRgn.DeleteObject();
	return TRUE;
	//return CWnd::OnEraseBkgnd(pDC);
}
//*************************************************************************************************
void CBCGPVisualManagerVS2008::OnHighlightMenuItem (CDC* pDC, CBCGPToolbarMenuButton* pButton,
											CRect rect, COLORREF& clrText)
{
	ASSERT_VALID (pDC);
	ASSERT_VALID (pButton);

	if (globalData.m_nBitsPerPixel <= 8 || globalData.IsHighContastMode ())
	{
		CBCGPVisualManagerVS2005::OnHighlightMenuItem (pDC, pButton, rect, clrText);
		return;
	}

	const int nRoundSize = 3;
	const BOOL bIsWinXPBlue = (GetStandardWinXPTheme () == WinXpTheme_Blue);

	COLORREF clr1 = bIsWinXPBlue ? WINXPBLUE_GRADIENT_DARK : m_clrHighlightGradientDark;
	COLORREF clr2 = bIsWinXPBlue ? WINXPBLUE_GRADIENT_LIGHT : m_clrHighlightGradientLight;
	COLORREF clrBorder = bIsWinXPBlue ? WINXPBLUE_MENUITEM_BORDER : m_clrHighlightGradientDark;

	if (m_bOSColors)
	{
		clr1 = m_clrHighlight;
		clr2 = RGB (255, 255, 255);
		clrBorder = m_clrHighlightDn;
	}

	if (DYNAMIC_DOWNCAST(CBCGPCustomizeMenuButton, pButton) == NULL)
	{
		rect.DeflateRect (2, 0);
	}

	CRgn rgn;
	rgn.CreateRoundRectRgn (rect.left, rect.top, rect.right, rect.bottom, nRoundSize, nRoundSize);

	pDC->SelectClipRgn (&rgn);

	CBCGPDrawManager dm (*pDC);
	dm.FillGradient (rect, clr1, clr2, TRUE);

	pDC->SelectClipRgn (NULL);

	CPen pen (PS_SOLID, 1, clrBorder);
	CPen* pOldPen = pDC->SelectObject (&pen);
	CBrush* pOldBrush = (CBrush*) pDC->SelectStockObject (NULL_BRUSH);

	pDC->RoundRect (rect.left, rect.top, rect.right, rect.bottom, nRoundSize + 2, nRoundSize + 2);

	pDC->SelectObject (pOldPen);
	pDC->SelectObject (pOldBrush);

	clrText = GetHighlightedMenuItemTextColor (pButton);
}
예제 #17
0
파일: UserAddDlg.cpp 프로젝트: dulton/nampu
void CUserAddDlg::OnPaint()
{

	CPaintDC dc(this);
	CDC szMemDC;
	CRect rcClient;
	CRect rc;
	GetClientRect(&rcClient);


	CBitmap bitmap;
	bitmap.LoadBitmap(IDB_HEAD);
	CDC memdc;
	memdc.CreateCompatibleDC(&dc);
	BITMAP bit;
	bitmap.GetBitmap(&bit);
	memdc.SelectObject(&bitmap);
	// rcClient.InflateRect(1,1,1,1);
	dc.StretchBlt(0,0,rcClient.Width(),rcClient.Height(),&memdc,0,0,bit.bmWidth,bit.bmHeight,SRCCOPY);

	rc = rcClient;
	rc.bottom = 31;
	szMemDC.CreateCompatibleDC(&dc);
	DrawRangeImage(0,&dc,rc);//top

	rc = rcClient;
	rc.right = 1;
	rc.top = rcClient.top - 31;
	DrawRangeImage(1,&dc,rc);//left

	rc = rcClient;
	rc.left = rcClient.right - 5;
	rc.top = rcClient.top - 31;
	DrawRangeImage(1,&dc,rc);//right

	rc = rcClient;
	rc.top = rcClient.bottom - 5;
	DrawRangeImage(0,&dc,rc);//bottom


	COLORREF col = RGB(255,0,255);//修改对话框外形

	CRgn rgn;
	rgn.CreateRoundRectRgn (1, 1, rcClient.Width(), rcClient.Height(),6,6);

	SetWindowRgn (rgn, TRUE);

	dc.SetTextColor(RGB(255,255,240));
	dc.SetBkMode(TRANSPARENT);
	dc.TextOut(10,5,_T("用户添加"));
}
예제 #18
0
void GPDrawCtrlRoundBk( CWnd* pWndChild, CDC* pDC, int nAngle /*= 2*/, int nOffX /*= 3*/, int nOffY /*= 2*/, COLORREF clrFrame /*= RGB(0,0, 255)*/, COLORREF clrBk /*= RGB(0,0,0)*/ )
{
	CRect rcFmTmp;
	pWndChild->GetWindowRect(rcFmTmp);
	pWndChild->GetParent()->ScreenToClient(rcFmTmp);
	rcFmTmp.InflateRect(nOffX,nOffX,nOffY,nOffY);
	CBrush brush1, brush2;
	brush1.CreateSolidBrush(clrBk);
	brush2.CreateSolidBrush(clrFrame);
	CRgn rgn;
	rgn.CreateRoundRectRgn(rcFmTmp.left, rcFmTmp.top, rcFmTmp.right, rcFmTmp.bottom, nAngle, nAngle);
	pDC->FillRgn(&rgn,  &brush1);
	pDC->FrameRgn(&rgn, &brush2, 1, 1);
}
예제 #19
0
//添加Owner Draw属性
void CMyButton::PreSubclassWindow()
{
    // TODO: Add your specialized code here and/or call the base class
    ModifyStyle(0, BS_OWNERDRAW);

    //设置按钮的有效区域,消除残角
    CRgn rgn;
    RECT rect;
    GetClientRect(&rect);

    //有效区域是一个角半径为5的圆角矩形
    rgn.CreateRoundRectRgn(rect.left,rect.top,rect.right,rect.bottom,5,5);
    SetWindowRgn(rgn,TRUE);
    rgn.DeleteObject();
    CButton::PreSubclassWindow();
}
예제 #20
0
BOOL CDlgMatchAwards::OnInitDialog()
{
	CDialog::OnInitDialog();

	//变量定义
	CPngImage ImageBack;

	//加载图片
	ImageBack.LoadImage(GetModuleHandle(GAME_FRAME_DLL_NAME), TEXT("MATCH_AWARDS"));
	m_btCloseAwards.SetButtonImage(IDB_BT_CLOSE_AWARDS,GetModuleHandle(GAME_FRAME_DLL_NAME),false,false);
	m_btCloseAwards.SetWindowPos(NULL,ImageBack.GetWidth()-55,30,27,22,SWP_NOZORDER);

    SetWindowPos(NULL, 0,0,ImageBack.GetWidth(),ImageBack.GetHeight(),SWP_NOZORDER|SWP_NOMOVE|SWP_NOREDRAW);
	CenterWindow();

	//获取窗口
	CRect rcWindow;
	GetWindowRect(&rcWindow);

	//计算位置
	CRect rcUnLayered;
	rcUnLayered.top=20;
	rcUnLayered.left=20;
	rcUnLayered.right=rcWindow.Width()-20;
	rcUnLayered.bottom=rcWindow.Height()-20;

	//设置大小
	CSize SizeWindow(ImageBack.GetWidth(),ImageBack.GetHeight());

	//设置区域
	CRgn RgnWindow;
	RgnWindow.CreateRoundRectRgn(rcUnLayered.left,rcUnLayered.top,rcUnLayered.right+1,rcUnLayered.bottom+1,7,7);

	//设置区域
	SetWindowRgn(RgnWindow,FALSE);

	//分层窗口
	m_SkinLayered.CreateLayered(this,rcWindow);
	m_SkinLayered.InitLayeredArea(ImageBack,255,rcUnLayered,CPoint(7,7),false);

	return TRUE; 
}
예제 #21
0
//*****************************************************************************
BOOL CMacStyle::OnSetWindowRegion (CWnd* pWnd, CSize sizeWindow)
{
	ASSERT_VALID (pWnd);

	if (pWnd->GetSafeHwnd () == NULL)
	{
		return FALSE;
	}

    CSize sz (0, 0);

	BOOL bMainWnd = pWnd == AfxGetMainWnd ();

	if (bMainWnd)
	{
		if ((pWnd->GetStyle () & WS_MAXIMIZE) == WS_MAXIMIZE)
		{
			pWnd->SetWindowRgn (NULL, TRUE);
			return TRUE;
		}

		sz  = CSize (9, 9);

		bMainWnd = TRUE;
	}

	if (sz != CSize (0, 0))
	{
        CRgn rgn;
		BOOL bCreated = FALSE;

		bCreated = rgn.CreateRoundRectRgn (0, 0, sizeWindow.cx + 1, sizeWindow.cy + 1, sz.cx, sz.cy);

		if (bCreated)
		{
			pWnd->SetWindowRgn ((HRGN)rgn.Detach (), TRUE);
			return TRUE;
		}
	}

	return FALSE;
}
예제 #22
0
// CSafeManDlg 消息处理程序
BOOL CSafeManDlg::OnInitDialog()
{
	CDialogSK::OnInitDialog();

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO: 在此添加额外的初始化代码

	// 创建圆角对话框
	CRect dialogRect; 
	GetClientRect(&dialogRect); 
	CRgn rgn; 
	rgn.CreateRoundRectRgn(0,0,dialogRect.Width(),dialogRect.Height(),20,20); 
	SetWindowRgn(rgn,TRUE); 

	SetBitmap(IDB_BACKGROUND);

	m_ProcessManager.LoadBitmap(IDB_PROCESSMANAGER);  // 悬停按钮载入位图
	m_SSDTManager.LoadBitmap(IDB_SSDTMANAGER);  // 悬停按钮载入位图
	m_MonitorManager.LoadBitmap(IDB_MONITORMANAGER);  // 悬停按钮载入位图
	m_Min.LoadBitmap(IDB_MIN);
	m_Exit.LoadBitmap(IDB_EXIT);
	m_Tray.LoadBitmap(IDB_TRAY);

	m_ProcessManager.SetState(TRUE);
	m_SSDTManager.SetState(FALSE);
	m_MonitorManager.SetState(FALSE);

	m_pProcessManager->Create(IDD_PROCESSMANAGER, this);
	m_pSSDTManager->Create(IDD_SSDTMANAGER, this);
	m_pMonitorManager->Create(IDD_MONITORMANAGER, this);

	m_pProcessManager->ShowWindow(SW_SHOW);  
	m_pSSDTManager->ShowWindow(SW_HIDE);  
	m_pMonitorManager->ShowWindow(SW_HIDE);

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
예제 #23
0
BOOL COptLgnDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	CRect rcClient(0, 0, 469, 179);
	MoveWindow(&rcClient, FALSE);
	CRgn rgn;
	rgn.CreateRoundRectRgn(0, 0, rcClient.Width(), rcClient.Height(), 10, 10);

	CRect rc = CRect(10, 5, 10 + 100, 30);
	m_btnCaption.MoveWindow(&rc);

	rc = CRect(rcClient.right-56, 3, rcClient.right-15, 24+3);
	m_btnClose.MoveWindow(&rc);
	m_btnClose.SetImage(TEXT("Skin/Wnd/SysSet/按钮_关闭_默认状态.png"), 
		TEXT("Skin/Wnd/SysSet/按钮_关闭_鼠标经过.png"), TEXT("Skin/Wnd/SysSet/按钮_关闭_鼠标按下.png"));

	rc = CRect(188, 60, 400, 85);
	m_btnTip.MoveWindow(&rc);

	rc.OffsetRect(5, 32);
	rc.right = rc.left + 245; rc.bottom = rc.top + 16;
	m_edtPassword.MoveWindow(&rc);

	rc = CRect(200, 130, 200+97, 130+25);
	m_btnOK.SetImage(TEXT("Skin/Wnd/optlogin/按钮_登陆_默认状态.png"),
		TEXT("Skin/Wnd/optlogin/按钮_登陆_鼠标经过.png"));
	m_btnOK.MoveWindow(&rc);

	rc.OffsetRect(rc.Width() + 20, 0);
	m_btnCancel.SetImage(TEXT("Skin/Wnd/optlogin/按钮_取消_默认状态.png"),
		TEXT("Skin/Wnd/optlogin/按钮_取消_鼠标经过.png"));
	m_btnCancel.MoveWindow(&rc);

	SetWindowRgn(rgn, TRUE);
	CenterWindow();

	m_edtPassword.SetFocus();
	return FALSE;
}
예제 #24
0
BOOL CDlgLgn::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetWindowText(TEXT("挂机锁"));


	CRect rc(0, 0, 463, 215);
	SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
	MoveWindow(&rc, FALSE);

	CRgn rgn;
	rgn.CreateRoundRectRgn(rc.left, rc.top, rc.right, rc.bottom, 5, 5);

	CRect rx(rc.right - 51, 3, rc.right - 10, 27);
	m_btnClose.MoveWindow(&rx);
	m_btnClose.SetImage(IDB_CLOSE, IDB_CLOSE1, IDB_CLOSE2);

	rx = CRect(250, 100, 435, 100+15);
 	m_edtPwd.MoveWindow(&rx);

	rx.OffsetRect(0, 30);
	m_edtPwd2.MoveWindow(&rx);

	rx = CRect(182, 160, 182+97, 160+25);
	m_btnOk.MoveWindow(&rx);
	m_btnOk.SetImage(IDB_OK);

	rx.OffsetRect(rx.Width() + 10, 0);
	m_btnCancel.MoveWindow(&rx);
	m_btnCancel.SetImage(IDB_CANCEL);

	MoveWindow(&rc, FALSE);
	SetWindowRgn(rgn, TRUE);
	CenterWindow();

	m_edtPwd.SetFocus();
	return FALSE;
}
예제 #25
0
BOOL CUptOptDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CRect rcClient(0, 0, 356, 218);
	CRgn rgn;
	rgn.CreateRoundRectRgn(rcClient.left, rcClient.top, rcClient.right, rcClient.bottom, 5, 5);

	CRect rc = rcClient;
	rc.left = rc.right - 51;
	rc.right = rc.right - 10;
	rc.bottom = rc.top + 24;
	m_btnClose.MoveWindow(&rc);
	m_btnClose.SetImage(TEXT("Skin/Wnd/GongGao/x.png"), TEXT("Skin/Wnd/GongGao/x_a.png"));

	rc = CRect(60, 52, 260, 76);
	m_btnQuick.MoveWindow(&rc);
	m_btnQuick.SetCheck(BST_CHECKED);

	rc.OffsetRect(0, 40);
	m_btnForce.MoveWindow(&rc);

	rc.OffsetRect(-10, 60);
	rc.right = rc.left + 97; rc.bottom = rc.top + 25;
	m_btnOK.SetImage(TEXT("Skin/Wnd/GongGao/按钮_确定_默认状态.png"), 
		TEXT("Skin/Wnd/GongGao/按钮_确定_鼠标经过.png"));
	m_btnOK.MoveWindow(&rc);

	rc.OffsetRect(rc.Width() + 20, 0);
	m_btnCancel.SetImage(TEXT("Skin/Wnd/GongGao/button03.png"), 
		TEXT("Skin/Wnd/GongGao/按钮_取消_鼠标经过.png"));
	m_btnCancel.MoveWindow(&rc);

	MoveWindow(&rcClient, FALSE);
	CenterWindow();
	SetWindowRgn(rgn, TRUE);

	return TRUE;
}
예제 #26
0
BOOL CMsgDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CRect rcClient(0, 0, 463, 215);
	CRgn rgn;
	rgn.CreateRoundRectRgn(rcClient.left, rcClient.top, rcClient.right, rcClient.bottom, 5, 5);

	CRect rc = rcClient;
	rc.left = rc.right - 51;
	rc.right = rc.right - 10;
	rc.bottom = rc.top + 24;
	m_btnClose.MoveWindow(&rc);
	m_btnClose.SetImage(TEXT("Skin/Wnd/Msg/x.png"), TEXT("Skin/Wnd/Msg/x_a.png"));

	rc.left = 10; rc.top = 5;
	rc.bottom = rc.top + 24; rc.right = rc.left + 100;
	m_btnTip.MoveWindow(&rc);
	m_btnTip.SetTextStyle(DEFAULT_FONT_NAME, 12, RGB(255, 255, 255), RGB(255, 255, 255),
		RGB(255, 255, 255), RGB(255, 255, 255));

	rc.left = 200; rc.top = 175;
	rc.right = rc.left + 97; rc.bottom = rc.top + 25;
	m_btnOK.SetImage(TEXT("Skin/Wnd/Msg/button01.png"));
	m_btnOK.MoveWindow(&rc);

	m_btnContent.MoveWindow(10, 40, 440, 80);
	m_btnContent.SetWindowText(m_strContent);
	m_btnContent.SetTextStyle(DEFAULT_FONT_NAME, 12, RGB(255, 255, 0), RGB(255, 255, 0),
		RGB(255, 255, 0), RGB(255, 255, 0), CButtonEx::BTEXT_CENTER);

	MoveWindow(&rcClient, FALSE);
	CenterWindow();
	SetWindowRgn(rgn, TRUE);

	return TRUE;
}
예제 #27
0
void CBaseDialog::OnSize(UINT nType, int cx, int cy)
{
	CSkinDialog::OnSize(nType, cx, cy);

	//移动准备
	HDWP hDwp=BeginDeferWindowPos(64);
	UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER;

	DeferWindowPos(hDwp,m_btClose,NULL,cx-25,25,0,0,uFlags|SWP_NOSIZE);
	DeferWindowPos(hDwp,m_btMax,NULL,cx-50,25,0,0,uFlags|SWP_NOSIZE);
	DeferWindowPos(hDwp,m_btMin,NULL,cx-75,25,0,0,uFlags|SWP_NOSIZE);

	//结束调整
	LockWindowUpdate();
	EndDeferWindowPos(hDwp);
	UnlockWindowUpdate();

	//设置圆角
	CRgn rgn;
	rgn.CreateRoundRectRgn(0,0,cx,cy,4,4);
	SetWindowRgn(rgn,FALSE);

	Invalidate(FALSE);
}
예제 #28
0
void CMFCAppDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialogEx::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码
/*	CRect rcClient(0, 0, cx, cy);
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, 0, 0, &rcClient);
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &rcClient, &rcClient);//*/
	//RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

	if (nType == SIZE_MINIMIZED)
	{
		ShowWindow(SW_HIDE);
	}

	CRgn rgn;
	CRect rc;
	GetWindowRect(&rc);
	//获得窗口矩形
	rc -= rc.TopLeft();
	rgn.CreateRoundRectRgn(rc.left, rc.top, rc.right, rc.bottom, 5, 5);
	//根据窗口矩形创建一个圆角矩形最后两个是形成圆角的大小
	SetWindowRgn(rgn, TRUE);//*/
}
예제 #29
0
파일: ButtonXP.cpp 프로젝트: AaronZhangL/CC
//添加Owner Draw属性
void CButtonXP::PreSubclassWindow() 
{
	// TODO: Add your specialized code here and/or call the base class
	ModifyStyle(0, BS_OWNERDRAW);
	CButton::PreSubclassWindow();

	// Set initial default state flag
	if(m_nTypeStyle == BS_DEFPUSHBUTTON)
	{
		m_nTypeStyle = BS_PUSHBUTTON;
	} 

	//设置按钮的有效区域
	CRgn rgn;
	CRect rc;
	GetClientRect(&rc);

	//有效区域为一个角半径为5的圆角矩形
	rgn.CreateRoundRectRgn(rc.left, rc.top, rc.right, rc.bottom, 5, 5);

	SetWindowRgn(rgn, TRUE);

	rgn.DeleteObject();
}
예제 #30
0
BOOL CMyDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	ModifyStyle(0,WS_SYSMENU | WS_MINIMIZEBOX);
	DWORD dwStyle = GetStyle();//获取旧样式  
	DWORD dwNewStyle = WS_OVERLAPPED | WS_VISIBLE| WS_SYSMENU |WS_MINIMIZEBOX
		|WS_MAXIMIZEBOX|WS_CLIPCHILDREN|WS_CLIPSIBLINGS;  
	dwNewStyle&=dwStyle;//按位与将旧样式去掉  
	SetWindowLong(m_hWnd,GWL_STYLE,dwNewStyle);//设置成新的样式  
	DWORD dwExStyle = GetExStyle();//获取旧扩展样式  
	DWORD dwNewExStyle = WS_EX_LEFT |WS_EX_LTRREADING |WS_EX_RIGHTSCROLLBAR;  
	dwNewExStyle&=dwExStyle;//按位与将旧扩展样式去掉  
	SetWindowLong(m_hWnd,GWL_EXSTYLE,dwNewExStyle);//设置新的扩展样式  
	//告诉windows:我的样式改变了,窗口位置和大小保持原来不变!  

	CRect rcWnd;
	GetClientRect(rcWnd);
	rcWnd.InflateRect(m_nLeftBorder,m_nTopBorder,m_nRightBorder,m_nBottomBorder);
	MoveWindow(0,0,rcWnd.Width(),rcWnd.Height(),TRUE);
	CRgn rgn;
	rgn.CreateRoundRectRgn(0,0,rcWnd.Width(),rcWnd.Height(),5,5);
	SetWindowRgn(rgn,FALSE);
	CWnd *pClildWnd=GetWindow(GW_CHILD);
	CRect rcChlid;
	while (pClildWnd)
	{
		pClildWnd->GetWindowRect(rcChlid);
		pClildWnd->MoveWindow(rcChlid.left+m_nLeftBorder,rcChlid.top+m_nTopBorder,rcChlid.Width(),rcChlid.Height(),TRUE);
		pClildWnd=pClildWnd->GetWindow(GW_HWNDNEXT);
	}
	CenterWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}