void CPainterView::OnDrawFill()
{
// TODO: Add your command handler code here
DrawType=new BYTE;
*DrawType=FILL;
}void CPainterView::OnSelchangeFillPattern()
{
// TODO: Add your control notification handler code here
CMainFrame *OwnWnd;
OwnWnd=(CMainFrame *)GetParentOwner();
CWnd* pWnd=OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PREVIEW);
CComboBox* pCBox = (CComboBox*)OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PATTERN);
CRect rect;
pWnd->GetClientRect(rect);
CDC *dc=pWnd->GetDC(); dc->Rectangle(rect);
hatchIndex= pCBox->GetCurSel();
CBrush Brush;
if(hatchIndex== 6)
{
Brush.CreateSolidBrush(CurColor);
hatchIndex=SOLIDBRUSH;
}
else
{
//////////////////////////////////////////////////////////
//#define HS_HORIZONTAL 0 /* ----- */
//#define HS_VERTICAL 1 /* ||||| */
//#define HS_FDIAGONAL 2 /* \\\\\ */
//#define HS_BDIAGONAL 3 /* ///// */
//#define HS_CROSS 4 /* +++++ */
//#define HS_DIAGCROSS 5 /* xxxxx */
///////////////////////////////////////////////////////// Brush.CreateHatchBrush( hatchIndex, CurColor );
}
dc->FillRect(rect,&Brush);
}
//处理选择填充颜色
void CPainterView::OnColor()
{
// TODO: Add your control notification handler code here
CColorDialog color; if(color.DoModal()==IDOK)
{
CMainFrame *OwnWnd;
OwnWnd=(CMainFrame *)GetParentOwner();
//获得对话框工具条中填充预览框的指针
CWnd* pWnd = OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PREVIEW);
//获得对话框工具条中填充模式组合框的指针
CComboBox* pCBox = (CComboBox*)OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PATTERN); CRect rect;
pWnd->GetClientRect(rect);//获得对话框工具条中填充预览框的客户矩形
CDC *dc=pWnd->GetDC(); //以当前填充模式填充预览框,并设置组合框选项
CurColor = color.GetColor();
int i = pCBox->GetCurSel();
CBrush Brush;
if(i==6)
{
Brush.CreateSolidBrush(CurColor);
hatchIndex=SOLIDBRUSH;
}
else
{
hatchIndex = i;
Brush.CreateHatchBrush( hatchIndex, CurColor );
}
dc->FillRect(rect,&Brush);
}
struct FILLNODE
{
BYTE bType;//图元类型
// 该记录的状态:bDo>0 显示;bD0<=0 不显示
// -3-粘贴,-6-剪切,0-不显示,1-显示,2-被选择,3-粘贴,5-移动,6-剪切,7-移动被恢复
BOOL bDo;
POINT Seed;//填充的种子点
COLORREF BoundColor;//填充覆盖的颜色范围
BRUSHTYPE brush;//填充所用画笔
FILLNODE()//填充图元的初始化函数
{
bType=FILL;
bDo=TRUE;
};
};
上面是填充颜色的源码,就是在填充的时候,出现<必须的资源无法得到>.使我我发填充.那位能帮我改改?
{
// TODO: Add your command handler code here
DrawType=new BYTE;
*DrawType=FILL;
}void CPainterView::OnSelchangeFillPattern()
{
// TODO: Add your control notification handler code here
CMainFrame *OwnWnd;
OwnWnd=(CMainFrame *)GetParentOwner();
CWnd* pWnd=OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PREVIEW);
CComboBox* pCBox = (CComboBox*)OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PATTERN);
CRect rect;
pWnd->GetClientRect(rect);
CDC *dc=pWnd->GetDC(); dc->Rectangle(rect);
hatchIndex= pCBox->GetCurSel();
CBrush Brush;
if(hatchIndex== 6)
{
Brush.CreateSolidBrush(CurColor);
hatchIndex=SOLIDBRUSH;
}
else
{
//////////////////////////////////////////////////////////
//#define HS_HORIZONTAL 0 /* ----- */
//#define HS_VERTICAL 1 /* ||||| */
//#define HS_FDIAGONAL 2 /* \\\\\ */
//#define HS_BDIAGONAL 3 /* ///// */
//#define HS_CROSS 4 /* +++++ */
//#define HS_DIAGCROSS 5 /* xxxxx */
///////////////////////////////////////////////////////// Brush.CreateHatchBrush( hatchIndex, CurColor );
}
dc->FillRect(rect,&Brush);
}
//处理选择填充颜色
void CPainterView::OnColor()
{
// TODO: Add your control notification handler code here
CColorDialog color; if(color.DoModal()==IDOK)
{
CMainFrame *OwnWnd;
OwnWnd=(CMainFrame *)GetParentOwner();
//获得对话框工具条中填充预览框的指针
CWnd* pWnd = OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PREVIEW);
//获得对话框工具条中填充模式组合框的指针
CComboBox* pCBox = (CComboBox*)OwnWnd->m_wndMyDialogBar.GetDlgItem(IDC_FILL_PATTERN); CRect rect;
pWnd->GetClientRect(rect);//获得对话框工具条中填充预览框的客户矩形
CDC *dc=pWnd->GetDC(); //以当前填充模式填充预览框,并设置组合框选项
CurColor = color.GetColor();
int i = pCBox->GetCurSel();
CBrush Brush;
if(i==6)
{
Brush.CreateSolidBrush(CurColor);
hatchIndex=SOLIDBRUSH;
}
else
{
hatchIndex = i;
Brush.CreateHatchBrush( hatchIndex, CurColor );
}
dc->FillRect(rect,&Brush);
}
struct FILLNODE
{
BYTE bType;//图元类型
// 该记录的状态:bDo>0 显示;bD0<=0 不显示
// -3-粘贴,-6-剪切,0-不显示,1-显示,2-被选择,3-粘贴,5-移动,6-剪切,7-移动被恢复
BOOL bDo;
POINT Seed;//填充的种子点
COLORREF BoundColor;//填充覆盖的颜色范围
BRUSHTYPE brush;//填充所用画笔
FILLNODE()//填充图元的初始化函数
{
bType=FILL;
bDo=TRUE;
};
};
上面是填充颜色的源码,就是在填充的时候,出现<必须的资源无法得到>.使我我发填充.那位能帮我改改?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货