Click here to Skip to main content
15,884,808 members
Articles / Desktop Programming / MFC

SolidGraph CAD System

Rate me:
Please Sign up or sign in to vote.
4.97/5 (78 votes)
12 Sep 20062 min read 375.2K   29.8K   209  
A SolidGraph CAD system source code.
#include "stdafx.h"
#include "LineThiknessCombo.h"
#include ".\linethiknesscombo.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CLineThiknessCombo::CLineThiknessCombo():
  CComboBox()
{
}

void CLineThiknessCombo::MeasureItem(LPMEASUREITEMSTRUCT lpMIS)
{ 
  //lpMIS->itemWidth = 100;//(m_nItemWidth + 2);
  //lpMIS->itemHeight = 20;//(m_nItemHeight + 2);
}

void CLineThiknessCombo::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
  CDC* pDC = CDC::FromHandle(lpDIS->hDC);

  COLORREF	crNormal = GetSysColor( COLOR_WINDOW );
 
  pDC->SetBkColor( crNormal );					// Set BG To Highlight Color
  pDC->FillSolidRect( &lpDIS->rcItem, crNormal );	// Erase Item
  
  if( lpDIS -> itemState & ODS_FOCUS )								// If Item Has The Focus
  {
	  pDC->DrawFocusRect( &lpDIS->rcItem );				// Draw Focus Rect
  }
  
    CPen penHighlight(PS_SOLID, lpDIS->itemID+1, RGB(0,0,0));
    CPen* pOldPen = pDC->SelectObject(&penHighlight);

    pDC->MoveTo(lpDIS->rcItem.left,
				lpDIS->rcItem.top+(lpDIS->rcItem.bottom-lpDIS->rcItem.top)/2);//lpDIS->rcItem.bottom/2);
	pDC->LineTo(lpDIS->rcItem.right,
				lpDIS->rcItem.top+(lpDIS->rcItem.bottom-lpDIS->rcItem.top)/2);//2);
  
    pDC->SelectObject(pOldPen);
 
}
//----------------------------------------------------------------------------

#ifdef _DEBUG
void CLineThiknessCombo::PreSubclassWindow() 
{
  CComboBox::PreSubclassWindow();

  ASSERT(GetStyle() & CBS_DROPDOWNLIST);
  ASSERT(GetStyle() & CBS_OWNERDRAWFIXED);
}
#endif

//----------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CLineThiknessCombo, CComboBox)
	ON_WM_CREATE()
END_MESSAGE_MAP()

int CLineThiknessCombo::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CComboBox::OnCreate(lpCreateStruct) == -1)
		return -1;

	AddString(" sd");
	AddString(" sd");
	AddString(" sd");
	AddString(" sd");
	AddString(" sd");
	
	return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions