예제 #1
0
void CListCtrl_Sortable::PreSubclassWindow()
{
	CListCtrl::PreSubclassWindow();

	// Focus retangle is not painted properly without double-buffering
#if (_WIN32_WINNT >= 0x501)
	SetExtendedStyle(LVS_EX_DOUBLEBUFFER | GetExtendedStyle());
#endif
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);


	EnableWindowTheme(GetSafeHwnd(), L"Explorer", NULL);
	//m_hDC = ::GetDC(m_hWnd);
}
예제 #2
0
void CSortListCtrl::PreSubclassWindow()
{
	// the list control must have the report style.
	ASSERT( GetStyle() & LVS_REPORT );

	CListCtrl::PreSubclassWindow();

	#if (_WIN32_WINNT >= 0x501)
	SetExtendedStyle(LVS_EX_DOUBLEBUFFER | GetExtendedStyle());
#endif
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT);
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_HEADERDRAGDROP);
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_GRIDLINES);

	VERIFY( m_ctlHeader.SubclassWindow( GetHeaderCtrl()->GetSafeHwnd() ) );
}
예제 #3
0
void CGridListCtrl::PreSubclassWindow()
{
  CListCtrl::PreSubclassWindow();

  // Remove grid lines as this class adds them
  SetExtendedStyle(GetExtendedStyle() & (~LVS_EX_GRIDLINES));
}
예제 #4
0
int MakeControlText ( int iControlID, int iStyle, int iExtendedStyle, DWORD pText, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = SS_CENTER;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle = SS_LEFTNOWORDWRAP;		break;
		case 2 : dwSelectStyle = SS_LEFT;				break;
		case 3 : dwSelectStyle = SS_CENTER;				break;
		case 4 : dwSelectStyle = SS_RIGHT;				break;
		case 5 : dwSelectStyle = SS_SIMPLE;				break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, "STATIC", dwExtendedStyle, dwSelectStyle, (LPSTR)pText, iX, iY, iWidth, iHeight ) )
		return 0;

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #5
0
int MakeControlEdit ( int iControlID, int iStyle, int iExtendedStyle, DWORD pText, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = ES_LEFT;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle = ES_CENTER;										break;
		case 2 : dwSelectStyle = WS_VSCROLL | ES_MULTILINE | ES_READONLY;		break;
		case 3 : dwSelectStyle = WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL;	break;
		case 4 : dwSelectStyle = ES_NUMBER | ES_CENTER;							break;
		case 5 : dwSelectStyle = ES_NUMBER | ES_CENTER | ES_READONLY;			break;
		case 6 : dwSelectStyle = ES_LOWERCASE;									break;
		case 7 : dwSelectStyle = ES_UPPERCASE;									break;
		case 8 : dwSelectStyle = ES_PASSWORD;									break;
		case 9 : dwSelectStyle = ES_MULTILINE | ES_WANTRETURN;					break;
		case 10 : dwSelectStyle = ES_MULTILINE | ES_READONLY;					break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, "EDIT", dwExtendedStyle, dwSelectStyle, (LPSTR)pText, iX, iY, iWidth, iHeight ) )
		return 0;

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #6
0
int MakeControlComboBox ( int iControlID, int iStyle, int iExtendedStyle, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = CBS_DROPDOWNLIST;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle = CBS_SIMPLE;			break;
		case 2 : dwSelectStyle = CBS_DROPDOWN;			break;
		case 3 : dwSelectStyle = CBS_DROPDOWNLIST;		break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, "COMBOBOX", dwExtendedStyle, dwSelectStyle, "", iX, iY, iWidth, iHeight ) )
		return 0;

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #7
0
파일: MyListCtrl.cpp 프로젝트: bblr001/MVS
void CMyListCtrl::OnBeginDrag(LPNMHDR pnmhdr,LRESULT*)
{
  CPoint ptItem,ptAction,ptImage;
  NM_LISTVIEW *pnmListView = (NM_LISTVIEW *)pnmhdr;
  m_oldDNDStyle = GetExtendedStyle();

  if(m_oldDNDStyle != 0)SetExtendedStyle(0);
  ASSERT(!m_bDragging);
  m_bDragging = TRUE;
  m_iItemDrag = pnmListView->iItem;
  ptAction = pnmListView->ptAction;
  GetItemPosition(m_iItemDrag,&ptItem);
  GetOrigin(&m_ptOrigin);
  ASSERT(m_pImageListDrag == NULL);
  m_pImageListDrag = CreateDragImage(m_iItemDrag,&ptImage);
  m_sizeDelta = ptAction - ptImage;
  m_ptHotSpot = ptAction - ptItem + m_ptOrigin;
  m_pImageListDrag->DragShowNolock(TRUE);
  m_pImageListDrag->SetDragCursorImage(0,CPoint(0,0));
  m_pImageListDrag->BeginDrag(0,CPoint(0,0));

  ptAction -=m_sizeDelta;
  m_pImageListDrag->DragEnter(this,ptAction);
  m_pImageListDrag->DragMove(ptAction);
  m_iItemDrop = -1;
  SetCapture();
}
예제 #8
0
int MakeControlScrollbar ( int iControlID, int iStyle, int iExtendedStyle, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = SBS_VERT;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle = SBS_HORZ;			break;
		case 2 : dwSelectStyle = SBS_VERT;			break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, "SCROLLBAR", dwExtendedStyle, dwSelectStyle, "", iX, iY, iWidth, iHeight ) )
		return 0;

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Setup control
	SetScrollBarRange ( iControlID, 0, 0 );
	SetScrollBarPosition ( iControlID, 0 );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
int CArgumentsTableCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	ModifyStyle(0,LVS_REPORT | LVS_EDITLABELS | LVS_NOSORTHEADER | LVS_SINGLESEL);
	ModifyStyleEx(0,WS_EX_STATICEDGE);
	SetExtendedStyle(GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
	
	CRect rcClient;
	GetClientRect(&rcClient);
	InsertColumn(0,"Type",LVCFMT_LEFT,rcClient.Width()/2);
	InsertColumn(1,"Value",LVCFMT_LEFT,rcClient.Width()/2);	

	int nRow = 0;
	if(m_pArgs!=NULL) {
		int nCount = m_pArgs->GetCount();
		POSITION nIdx = m_pArgs->GetHeadPosition();
		while(nIdx!=NULL) {
			CArgument* pArg = m_pArgs->GetNext(nIdx);
			InsertItem(nRow,pArg->GetType());
			SetItemText(nRow,1,pArg->GetName());
			nRow++;
		}
	}
	InsertItem(nRow,CString(""));
	SetItemText(nRow,1,CString(""));
	
	return 0;
}
예제 #10
0
int MakeControlUpDown ( int iControlID, int iStyle, int iExtendedStyle, int iMin, int iMax, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = UDS_SETBUDDYINT | UDS_ARROWKEYS;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle |= 0;							break;
		case 2 : dwSelectStyle |= UDS_ALIGNLEFT;				break;
		case 3 : dwSelectStyle |= UDS_ALIGNRIGHT;				break;
		case 4 : dwSelectStyle |= UDS_HORZ;						break;
		case 5 : dwSelectStyle |= UDS_HORZ | UDS_ALIGNLEFT;		break;
		case 6 : dwSelectStyle |= UDS_HORZ | UDS_ALIGNRIGHT;	break;
		case 7 : dwSelectStyle |= UDS_WRAP;						break;
		case 8 : dwSelectStyle |= UDS_HORZ | UDS_WRAP;			break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, UPDOWN_CLASS, dwExtendedStyle, dwSelectStyle, "", iX, iY, iWidth, iHeight ) )
		return 0;

	// Setup control
	SetUpDownRange ( iControlID, iMin, iMax );
	SetUpDownPosition ( iControlID, iMin+((iMax-iMin)/2) );

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #11
0
void CIOSFileList::Init(CIOSDirectoryTree *iosDirectoryTree)
{
	SetBkColor(RGB(255,255,255));
	SetExtendedStyle(GetExtendedStyle()|LVS_EX_FULLROWSELECT);

	CRect rect;
	GetClientRect(rect);
	int width = (int)(rect.Width() * 0.15);
	InsertColumn(0, _T("名称"), LVCFMT_LEFT, rect.Width() - width * 4);
	InsertColumn(1, _T("类型"), LVCFMT_LEFT, width);
	InsertColumn(2, _T("大小"), LVCFMT_RIGHT, width);
	InsertColumn(3, _T("块大小"), LVCFMT_RIGHT, width);
	InsertColumn(4, _T("链接数"), LVCFMT_LEFT, width);

	m_imageList.Create(16,16,ILC_COLOR8 | ILC_MASK,2,2);
	m_imageList.SetBkColor(RGB(255,255,255)); 

	CBitmap bitmap[2];

	bitmap[0].LoadBitmap(IDB_FOLDER);
	m_imageList.Add(&bitmap[0], RGB(255,255,255));

	bitmap[1].LoadBitmap(IDB_SYMBOL_LINK);
	m_imageList.Add(&bitmap[1], RGB(255,255,255));
	
	SetImageList(&m_imageList, LVSIL_SMALL);

	m_indexList = iosDirectoryTree;
}
예제 #12
0
int MakeControlButton ( int iControlID, int iStyle, int iExtendedStyle, DWORD pText, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = BS_DEFPUSHBUTTON;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle = BS_PUSHBUTTON;			break;
		case 2 : dwSelectStyle = BS_RADIOBUTTON;		break;
		case 3 : dwSelectStyle = BS_AUTOCHECKBOX;		break;
		case 4 : dwSelectStyle = BS_3STATE;				break;
		case 5 : dwSelectStyle = BS_DEFPUSHBUTTON;		break;
		case 6 : dwSelectStyle = BS_AUTORADIOBUTTON;	break;
		case 7 : dwSelectStyle = BS_AUTOCHECKBOX;		break;
		case 8 : dwSelectStyle = BS_AUTO3STATE;			break;
		case 9 : dwSelectStyle = BS_ICON;				break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, "BUTTON", dwExtendedStyle, dwSelectStyle, (LPSTR)pText, iX, iY, iWidth, iHeight ) )
		return 0;

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #13
0
int MakeControlListView ( int iControlID, int iStyle, int iExtendedStyle, int iX, int iY, int iWidth, int iHeight )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = LVS_LIST;
	DWORD dwIconType = LVSIL_SMALL;
	DWORD dwIconSize = 16;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle = LVS_ICON | LVS_ALIGNTOP;	dwIconSize=16;	dwIconType=LVSIL_NORMAL;	break;
		case 2 : dwSelectStyle = LVS_ICON | LVS_ALIGNTOP;	dwIconSize=32;	dwIconType=LVSIL_NORMAL;	break;
		case 3 : dwSelectStyle = LVS_ICON | LVS_ALIGNTOP;	dwIconSize=48;	dwIconType=LVSIL_NORMAL;	break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, WC_LISTVIEW, dwExtendedStyle, dwSelectStyle, "", iX, iY, iWidth, iHeight ) )
		return 0;

	// Create image list
	g_pControls [ iControlID ].himlImageList = ImageList_Create(dwIconSize, dwIconSize, ILC_COLOR24, 0, 65535); 

	// Assign the image lists to the list view control. 
	HWND hwndLV = g_pControls [ iControlID ].hWnd;
	ListView_SetImageList(hwndLV, g_pControls [ iControlID ].himlImageList, dwIconType); 
	
	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( g_pControls [ iControlID ].hWnd, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #14
0
int COutputListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CBCGPListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

	return 0;
}
예제 #15
0
void CReportCtrl::SetGridLines(BOOL bSet)
{
	DWORD dwStype = GetExtendedStyle();
	if (bSet)
		dwStype |= LVS_EX_GRIDLINES;
	else
		dwStype &= ~LVS_EX_GRIDLINES;

	SetExtendedStyle(dwStype);	
}
예제 #16
0
void CMyListCtrl::InitList(CString csParams, int nCount)
{
  DeleteAllColumns();
  SetExtendedStyle(GetExtendedStyle()
                    |LVS_EX_GRIDLINES
                    |LVS_EX_FULLROWSELECT
                    |LVS_EX_SUBITEMIMAGES);
  SetParamCount(nCount);
  SetHead(csParams);
  AutoSize();
}
예제 #17
0
//------------------------------------------------------------------------------
//
// 	Function Name:	CMLListCtrl::Initialize()
//
//	Parameters:		pOwnerClass - an object of the class to be displayed
//					uResourceId - resource id for image list images
//
// 	Return Value:	None
//
// 	Description:	TRUE if successful
//
//------------------------------------------------------------------------------
BOOL CMLListCtrl::Initialize(CMLListCtrlElement* pOwnerClass, UINT uResourceId)
{
	CBitmap bmImages;

	SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT);

	//	Should we create an image list?
	if(uResourceId > 0)
	{
		//	Create the image list
		bmImages.LoadBitmap(uResourceId);
		m_aImages.Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 1);
		m_aImages.Add(&bmImages, RGB(255,0,255));  

		//	Attach the image list
		SetImageList(&m_aImages, LVSIL_SMALL);

		m_bUseImages = TRUE;
	}

	//	Delete any columns that may have already been added to the list view
	if(this->GetHeaderCtrl() != 0)
	{
		while(this->GetHeaderCtrl()->GetItemCount() > 0)	
			this->DeleteColumn(0);
	}
	
	//	Delete the existing columns
	if(m_pColumns != 0)
	{
		m_pColumns->Flush(TRUE);
		delete m_pColumns;
		m_pColumns = 0;
	}

	//	Get the new column collection from the owner
	if(pOwnerClass != 0)
		m_pColumns = pOwnerClass->GetListCtrlColumns();

	//	Add the new columns
	if(m_pColumns != 0)
	{
		for(int i = 0; i <= m_pColumns->GetUpperBound(); i++)
		{
			if(m_pColumns->GetAt(i) != 0)
				Add(m_pColumns->GetAt(i), i);
		}

		AutoSizeColumns();

	}

	return TRUE;
}
예제 #18
0
int CReportCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	lpCreateStruct->style &= ~MUST_NOT_STYLE;
	lpCreateStruct->style |= MUST_STYLE;
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	SetExtendedStyle(GetExtendedStyle());
	ASSERT(GetHeaderCtrl() != NULL);
	return 0;
}
예제 #19
0
파일: SCWListCtrl.cpp 프로젝트: Sp1l/pwsafe
void CSCWListCtrl::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
  if (!Fonts::GetInstance())
     return;
  
  int padding=4;
  if (GetExtendedStyle() & LVS_EX_GRIDLINES)
     padding+=2;
  
  lpMeasureItemStruct->itemHeight = Fonts::GetInstance()->CalcHeight()+padding;
  //Remove LVS_OWNERDRAWFIXED style to apply default DrawItem
  ModifyStyle(LVS_OWNERDRAWFIXED, 0);
}
예제 #20
0
//------------------------------------------------------------------------
//! Update the checkbox of the label column (first column)
//!
//! @param nGroupId ID of the group
//! @param bChecked The new check box state
//------------------------------------------------------------------------
void CGridListCtrlGroups::CheckEntireGroup(int nGroupId, bool bChecked)
{
	if (!(GetExtendedStyle() & LVS_EX_CHECKBOXES))
		return;

	for (int nRow=0; nRow<GetItemCount(); ++nRow)
	{
		if (GetRowGroupId(nRow) == nGroupId)
		{
			SetCheck(nRow, bChecked ? TRUE : FALSE);
		}
	}
}
예제 #21
0
int CReportCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	lpCreateStruct->style &= ~MUST_NOT_STYLE;
	lpCreateStruct->style |= MUST_STYLE;
	if(CListCtrl :: OnCreate(lpCreateStruct) == -1)
	{
		return(-1);
	}

	SetExtendedStyle(GetExtendedStyle());
	ASSERT(GetHeaderCtrl() != NULL);
	return(0);
}
예제 #22
0
//设置listctrl 风格及扩展风格
void CMyCListCtrl::SMT_SetListFormat()
{
	LONG lStyle;
	lStyle = GetWindowLong(m_hWnd, GWL_STYLE);//获取当前窗口style
	lStyle &= ~LVS_TYPEMASK; //清除显示方式位
	lStyle |= LVS_REPORT; //设置style
	SetWindowLong(m_hWnd, GWL_STYLE, lStyle);//设置style
	DWORD dwStyle = GetExtendedStyle();
	dwStyle |= LVS_EX_FULLROWSELECT;//选中某行使整行高亮(只适用与report风格的listctrl)
	dwStyle |= LVS_EX_GRIDLINES;//网格线(只适用与report风格的listctrl)
	dwStyle |= LVS_EX_CHECKBOXES;//item前生成checkbox控件
	SetExtendedStyle(dwStyle); //设置扩展风格
}
void CRasterResourceListCtrl::_OnInitListView(int cItems)
{
    // Put an imagelist in the view, for our pic previews.

    // Destroy any old list
    if (_himlPics)
    {
        ImageList_Destroy(_himlPics);
        _himlPics = NULL;
    }

    CSize sizeImages(VIEW_IMAGE_SIZE, VIEW_IMAGE_SIZE);
    // Note: this color depth must match that which we get back from the ViewResource
    // Also: ILC_MASK must be specified, because of the overlay
    _himlPics = ImageList_Create(sizeImages.cx, sizeImages.cy, ILC_COLOR8 | ILC_MASK, cItems, 30);
    
    if (_himlPics)
    {
        CImageList *pTemp = CImageList::FromHandle(_himlPics);
        if (pTemp)
        {
            HIMAGELIST himlOld = (HIMAGELIST)SetImageList(pTemp, LVSIL_NORMAL);
        }
        // pTemp is a temporary object that we don't need to delete.

        // Load an overlay image to use for "unused" items
        HBITMAP hbmOverlay = LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_OVERLAYOLD40));
        if (hbmOverlay)
        {
            int iOverlayImageIndex = ImageList_AddMasked(_himlPics, hbmOverlay, RGB(255, 0, 255));
            ImageList_SetOverlayImage(_himlPics, iOverlayImageIndex, OVERLAYINDEX_UNUSED);
            DeleteObject(hbmOverlay);
        }

        HBITMAP hbmCorrupt = LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_CORRUPTRESOURCE));
        if (hbmCorrupt)
        {
            _iCorruptBitmapIndex = ImageList_Add(_himlPics, hbmCorrupt, NULL);
            DeleteObject(hbmCorrupt);
        }
    }

    // Adjust the icon spacing so things don't look too spread out.
    CSize sizeSpacing(sizeImages.cx + 20, sizeImages.cy + 30);
    SetIconSpacing(sizeSpacing);

    // LVS_EX_BORDERSELECT, supported on IE 4.0 or later. -> Removed, as it causes problems in details view
    // LVS_EX_DOUBLEBUFFER, supported on XP or later.
    SetExtendedStyle(GetExtendedStyle() | 0x00010000 | LVS_EX_INFOTIP);

}
void CTDLFindResultsListCtrl::PreSubclassWindow()
{
	CEnListCtrl::PreSubclassWindow();

	// setup up result list
	InsertColumn(0, CEnString(IDS_FT_TASK));
	InsertColumn(1, CEnString(IDS_FT_WHATMATCHED), LVCFMT_LEFT, 250);
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_ONECLICKACTIVATE | LVS_EX_UNDERLINEHOT);
	SetHotCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
	SetView(LVS_REPORT);
	EnableHeaderTracking(FALSE);
	SetFirstColumnStretchy(TRUE);
	RefreshUserPreferences();
}
예제 #25
0
void CToolBarCtrlX::AdjustFont(int iMaxPointSize, CSize sizButton)
{
	// The toolbar control uses the font which is specified in the current system
	// metrics. It does not use the font which is used by the parent. So, if user
	// switched to "Large Font" mode in Windows System applet, we have to do some
	// adjustements because our toolbar is of fixed size and designed for 8 pt "MS Shell Dlg".
	//
	// This function is only needed when the toolbar control is dynamically created.
	// If it's created via a dialog resource the font property is handled as 
	// expected even when the font is changed in system applet during runtime.
	//
	// -> Avoid to use this function, it most likely creates glitches on some systems.

	// Toolbar control is very sensitive to font changes, adjust the font
	// only if really needed.
	CFont* pFont = GetFont();
	if (pFont)
	{
		LOGFONT lf = {0};
		if (pFont->GetLogFont(&lf) > 0)
		{
			HDC hDC = ::GetDC(HWND_DESKTOP);
			int iPointSize = -MulDiv(lf.lfHeight, 72, GetDeviceCaps(hDC, LOGPIXELSY));
			::ReleaseDC(NULL, hDC);
			if (iPointSize > iMaxPointSize)
			{
				CWnd* pwndParent = GetParent();
				ASSERT( pwndParent != NULL );
				if (pwndParent)
				{
					CFont* pFontDlg = pwndParent->GetFont();
					ASSERT( pFontDlg != NULL );
					if (pFontDlg)
					{
						SetFont(pFontDlg);

						// Toolbar control likes to resize buttons and stuff
						// when TBSTYLE_EX_DRAWDDARROWS is applied.
						if ((GetExtendedStyle() & TBSTYLE_EX_DRAWDDARROWS) != 0)
						{
							SetPadding(CSize(0, 0));
							SetButtonSize(sizButton);
						}
					}
				}
			}
		}
	}
}
예제 #26
0
int		CVirtualListCtrl::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  ここに特定な作成コードを追加してください。
	SetExtendedStyle( GetExtendedStyle() | LVS_EX_FULLROWSELECT /*| LVS_EX_GRIDLINES*/ );
	SetItemCount( USHRT_MAX );

	InsertColumn( 0, _T(""), LVCFMT_LEFT, SHRT_MAX/2 );

	SetTimer( 100, 200, NULL );

	return 0;
}
예제 #27
0
void CXListCtrl::PreSubclassWindow() 
{
	CListCtrl::PreSubclassWindow();

	DWORD dwStyle, dwExStyle;
	dwStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
	dwStyle |= (LVS_NOSORTHEADER|LVS_REPORT|LVS_SINGLESEL);
	SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle);
	dwExStyle = GetExtendedStyle();
	dwExStyle |= LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT| LVS_EX_GRIDLINES;
	SetExtendedStyle(dwExStyle);
	
	CImageList m_ImageList; 
	m_ImageList.Create(1,22,ILC_COLOR,1,1); 	 
	SetImageList(&m_ImageList,LVSIL_SMALL);
}
예제 #28
0
int MakeControlToolBar ( int iControlID, int iStyle, int iExtendedStyle, DWORD pFilename, int iNumberOfToolImages )
{
	// Assign the style
	DWORD dwExtendedStyle = GetExtendedStyle ( iExtendedStyle );
	DWORD dwSelectStyle = CCS_TOP;
	switch ( iStyle )
	{
		case 1 : dwSelectStyle |= 0;							break;
	}

	// Create control
	MaintainGlobalHWND();
	if ( !CreateControl ( iControlID, g_pGlob->hWnd, TOOLBARCLASSNAME, dwExtendedStyle, dwSelectStyle, "", 0, 0, 0, 0 ) )
		return 0;

	// Create image list
	g_pControls [ iControlID ].himlImageList = ImageList_Create(16, 16, ILC_COLOR24, 0, 65535); 

	// Assign the image lists to the list view control. 
	HWND hwndTB = g_pControls [ iControlID ].hWnd;

 	// Sets the size of the TBBUTTON structure.
	SendMessage(hwndTB, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);

	// Set the maximum number of text rows and bitmap size.
	SendMessage(hwndTB, TB_SETBITMAPSIZE,  0, (LPARAM)MAKELONG(16, 16));

	// Load bitmap for all buttons
	for ( int iI=0; iI<iNumberOfToolImages; iI++ )
	{
		char pFile[256];
		wsprintf ( pFile, "%s%d.bmp", pFilename, iI );
		HBITMAP hbmp = (HBITMAP)LoadImage(NULL, pFile,IMAGE_BITMAP,16,16,LR_LOADFROMFILE);
		ImageList_Add(g_pControls [ iControlID ].himlImageList,hbmp,NULL);
	}
	SendMessage(hwndTB, TB_SETIMAGELIST, 0, (LPARAM)g_pControls [ iControlID ].himlImageList);
	SendMessage(hwndTB, TB_SETHOTIMAGELIST, 0, (LPARAM)g_pControls [ iControlID ].himlImageList);

	// Subclass to get access to all control messages directly
	g_pControls [ iControlID ].lOriginalWinProc = SetWindowLong ( hwndTB, GWL_WNDPROC, (LONG)SubClassControlWinProc );

	// Update safe rects after new addition
	UpdateSafeRectsArray();

	// Success
	return 1;
}
예제 #29
0
void CReportCtrl::SetCheckboxeStyle(int nStyle)
{
	m_nChkStyle = nStyle;
	EndEdit(TRUE);
	DWORD dwStype = GetExtendedStyle();
	if (nStyle == 0)
	{
		dwStype &= ~LVS_EX_CHECKBOXES;		
	}
	else
	{
		dwStype |= LVS_EX_CHECKBOXES;
		_EnsureSingleCheck(-1);
	}

	SetExtendedStyle(dwStype);
}
예제 #30
0
void CParamsCtrl::Init()
{
	CString	s;
	int	i;
	for (i = 0; i < COLUMNS; i++) {
		const COL_INFO&	ci = m_ColInfo[i];
		s.LoadString(ci.Title);
		InsertColumn(i, s, ci.Align, ci.Width);
	}
	for (i = 0; i < NUM_PARMS; i++) {
		s.LoadString(m_ParmInfo[i].NameID);
		InsertItem(i, s);
	}
	int	style = GetExtendedStyle();
	SetExtendedStyle(style | LVS_EX_GRIDLINES);
	m_ImgList.Create(1, ROW_HEIGHT, ILC_COLOR4, 1, 1);
	SetImageList(&m_ImgList, LVSIL_SMALL); 	// set row height
}