一个复杂的画图系统

源代码在线查看: prop.cpp

软件大小: 266 K
上传用户: lichao0516
关键词: 画图
下载地址: 免注册下载 普通下载 VIP

相关代码

				// prop.cpp : implementation file
				//
				
				#include "stdafx.h"
				#include "geditor.h"
				#include "prop.h"
				#include "geditorDoc.h"
				#ifdef _DEBUG
				#define new DEBUG_NEW
				#undef THIS_FILE
				static char THIS_FILE[] = __FILE__;
				#endif
				
				/////////////////////////////////////////////////////////////////////////////
				// Cprop dialog
				
				
				Cprop::Cprop(CWnd* pParent /*=NULL*/)
					: CDialogBar()
				{/*
					 TC_ITEM tItem; 
				     tItem.mask = TCIF_TEXT; 
				     tItem.pszText = "&Tab 1"; 
				     tItem.cchTextMax = strlen(tItem.pszText); 
				     
				     m_tab.InsertItem(0, &tItem); 
				*/
					//{{AFX_DATA_INIT(Cprop)
					m_fill = FALSE;
					m_slx = _T("SX");
					m_sly = _T("SY");
					m_srx = _T("EX");
					m_sry = _T("EY");
					m_linesty = -1;
					m_widths = 0;
					//}}AFX_DATA_INIT
					//ASSERT(pParent!=NULL);
					m_parent=pParent;
					m_linesty=0;
					colum=0;
				
				}
				
				
				void Cprop::DoDataExchange(CDataExchange* pDX)
				{
					CDialogBar::DoDataExchange(pDX);
					//{{AFX_DATA_MAP(Cprop)
					DDX_Control(pDX, IDC_BKCOLOR, m_edgeclr);
					DDX_Control(pDX, IDC_CHKFILL, m_Fill);
					DDX_Control(pDX, IDC_COLOR, m_colr);
					DDX_Control(pDX, IDC_WIDTHS, m_wds);
					DDX_Control(pDX, IDC_SPINWIDTH, m_widthbdy);
					DDX_Control(pDX, IDC_LISTPROP, m_list);
					DDX_Control(pDX, IDC_EDITWDTH, m_wdth);
					DDX_Control(pDX, IDC_WIDTH, m_width);
					DDX_Control(pDX, IDC_OBJNAME, m_name);
					DDX_Check(pDX, IDC_CHKFILL, m_fill);
					DDX_Text(pDX, IDC_LEFTX, m_slx);
					DDX_Text(pDX, IDC_LEFTY, m_sly);
					DDX_Text(pDX, IDC_RIGHTX, m_srx);
					DDX_Text(pDX, IDC_RIGHTY, m_sry);
					DDX_Radio(pDX, IDC_RADSOLID, m_linesty);
					DDX_Text(pDX, IDC_WIDTHS, m_widths);
					DDV_MinMaxInt(pDX, m_widths, 1, 50);
					//}}AFX_DATA_MAP
				}
				
				
				BEGIN_MESSAGE_MAP(Cprop, CDialogBar)
					//{{AFX_MSG_MAP(Cprop)
					//}}AFX_MSG_MAP
				END_MESSAGE_MAP()
				
				/////////////////////////////////////////////////////////////////////////////
				// Cprop message handlers
				
				void Cprop::change(char *propname,int value)
				{
					//UpdateData(FALSE);
					item.mask=LVIF_TEXT|LVIF_STATE;
					item.state=0;
					item.stateMask=0;
				
					item.iItem=colum;
					item.iSubItem=0;
					item.pszText=propname;
					m_list.InsertItem(&item);
					sprintf(svalue,"%3d",value);
					m_list.SetItemText(colum,1,svalue);
					colum++;
					//UpdateData(FALSE);
				}
				void Cprop::change(int objtype,int column, int value)
				{
					switch(objtype)
					{
					case 0://line
						sprintf(svalue,"%3d",value);
						m_list.SetItemText(column,1,svalue);
						break;
					case 1:
						break;
					case 2:
						break;
					case 3:
						break;
					case 4:
						break;
					case 5:
						break;
					case 6:
						break;
					default:
						break;
					};
				}
				
				void Cprop::showname(CString name)
				{
					
				}
				
				void Cprop::InitProp()
				{
				/*	UpdateData(FALSE);
					LV_COLUMN lvcm;
					lvcm.mask=LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
					lvcm.fmt=LVCFMT_LEFT;
					lvcm.cx=67;
					lvcm.iSubItem=0;
					lvcm.pszText="Properity";
					m_list.InsertColumn(0,&lvcm);
					lvcm.cx=34;
					lvcm.iSubItem=1;
					lvcm.pszText="Val";
					m_list.InsertColumn(1,&lvcm);
					m_widthbdy.SetRange(1,40);
					m_widthbdy.SetBuddy(&m_wds);
					m_widthbdy.SetPos(1);
					m_Fill.EnableWindow(FALSE);
					bkclr=0;*/
				}
				
				
				void Cprop::OtherShow(COLORREF color,int width,int linesty)
				{
					if(color!=-1)
					{
						CBrush brush(color);
						CRect rect;
						rect.top=rect.left=2;
						rect.bottom=rect.right=17;
						m_colr.GetDC()->FillRect(&rect,&brush);
					};
					if (linesty!=-1) m_linesty=linesty;
					UpdateData(FALSE);
					m_widthbdy.SetPos(width);
				}
				
				void Cprop::ShowEdgeClr(unsigned int sel)
				{
					CRect rect;
					rect.left=rect.top=2;
					rect.right=rect.bottom=17;
					CBrush brush((COLORREF)sel);
					m_edgeclr.GetDC()->FillRect(&rect,&brush);
					brush.DeleteObject();
				}
							

相关资源