📄 毕业设计view.cpp
字号:
bmp->Darw(point.x-100,point.y);
bmp->BeiFen();
saved = 1;
}
else if(contyp == 2){//擦除
bmp->Clear(point.x-100,point.y);
bmp->BeiFen();
saved = 1;
}
else if(contyp == 3){//填充
bmp->BeiFen();
saved = 1;
}
else if(contyp == 4){//曲线
tx[5] ++;
if(tx[5] == 2){
tx[2] = tx[1] = point.x - 100;
ty[2] = ty[1] = point.y;
}
else if(tx[5] == 3){
tx[2] = point.x-100;
ty[2] = point.y;
tx[5] = 0;
}
bmp->ReBezier(tx,ty);
if(tx[5]==0){
bmp->BeiFen();
saved = 1;
}
}
else if(contyp == 5){//文字
texttool.Move(point.x-100-tx[0],point.y-ty[0]);
Invalidate(FALSE);
}
Invalidate(FALSE);
}
CFormView::OnLButtonUp(nFlags, point);
}
void CMyView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(lbd){
if(contyp == 0){//画笔工具
bmp->Line(tx[1],ty[1],point.x-100,point.y);
tx[1] = point.x-100;
ty[1] = point.y;
Invalidate(FALSE);
}
else if(contyp == 1){//画直线
bmp->ReLine(tx[0],ty[0],point.x-100,point.y,0,0);
tx[1] = point.x-100;
ty[1] = point.y;
Invalidate(FALSE);
}
else if(contyp == 2){//擦除
bmp->Clear(point.x-100,point.y);
tx[1] = point.x-100;
ty[1] = point.y;
Invalidate(FALSE);
}
else if(contyp == 4){//曲线
if(tx[5] == 0){
tx[3] = point.x - 100;ty [3] = point.y;
}
else if(tx[5] == 1){
tx[1] = tx[2] = point.x - 100;
ty[1] = ty[2] = point.y;
}
else{
tx[2] = point.x - 100;
ty[2] = point.y;
}
bmp->ReBezier(tx,ty);
Invalidate(FALSE);
}
else if(contyp == 5){//文字
texttool.Move(point.x-100-tx[0],point.y-ty[0]);
Invalidate(FALSE);
tx[0] = point.x-100;
ty[0] = point.y;
}
}
else if(rbd){
if(contyp == 0){
bmp->Line(tx[1],ty[1],point.x-100,point.y,1);
Invalidate(FALSE);
tx[1] = point.x-100;
ty[1] = point.y;
}
else if(contyp == 1){
bmp->ReLine(tx[0],ty[0],point.x-100,point.y,0,1);
Invalidate(FALSE);
tx[1] = point.x-100;
ty[1] = point.y;
}
}
CFormView::OnMouseMove(nFlags, point);
}
void CMyView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(lbd){
if(contyp==5){
return;
}
lbd = FALSE;
bmp->Cancel();
Invalidate(FALSE);
tx[5] = 0;
}
else if(point.x<bmp->GetW()+100&&point.y<bmp->GetH()&&point.x>=100){
rbd = TRUE;
if(contyp == 3){
bmp->TC(point.x-100,point.y,1);
Invalidate(FALSE);
}
else if(contyp == 2){
}
else{
tx[1] = tx[0] = point.x-100;
ty[1] = ty[0] = point.y;
}
}
CFormView::OnRButtonDown(nFlags, point);
}
void CMyView::OnRButtonUp(UINT nFlags, CPoint point){
//右键释放
if(rbd){
rbd = FALSE;
if(contyp == 0){
bmp->Line(tx[1],ty[1],point.x-100,point.y,1);
bmp->Darw(point.x-100,point.y,1);
}
else if(contyp == 1){
bmp->ReLine(tx[0],ty[0],point.x-100,point.y,1,1);
bmp->Darw(point.x-100,point.y,1);
}
bmp->BeiFen();
Invalidate(FALSE);
saved = 1;
}
CFormView::OnRButtonUp(nFlags, point);
}
void CMyView::OnMby()
{
// TODO: Add your command handler code here
// CSetAguDlg sad;
// sad.SetType(1);
// if(sad.DoModal() == IDOK){
// int i[1];
// bmp->HDTX(0);
// bmp->CZ(0,i,1,1,1);
bmp->BY();
saved = 1;
Invalidate(FALSE);
// }
}
void CMyView::OnMfd()
{
// TODO: Add your command handler code here
// CSetAguDlg sad;
// sad.SetType(1);
// if(sad.DoModal() == IDOK){
// int i[1];
// bmp->HDTX(0);
// bmp->CZ(1,i,1,1,1);
bmp->FD();
saved = 1;
Invalidate(FALSE);
// }
}
void CMyView::OnMlb()
{
CSetDlg2 sad;
if(sad.DoModal() == IDOK){
int i[1];
i[0] = sad.m_n;
bmp->CZ(2,i,1,1,1);
saved = 1;
Invalidate(FALSE);
}
}
void CMyView::OnMmh()
{
// TODO: Add your command handler code here
// CSetAguDlg sad;
// sad.SetType(1);
// if(sad.DoModal() == IDOK){
int i[1];
bmp->CZ(3,i,1,1,1);
saved = 1;
Invalidate(FALSE);
// }
}
void CMyView::OnMlu()
{
// TODO: Add your command handler code here
CSetAguDlg sad;
sad.SetStr("参数为0时,亮度不变,参数越大,亮度越高。");
if(sad.DoModal() == IDOK){
int i[1];
i[0] = sad.m_n;
bmp->CZ(4,i,sad.m_r,sad.m_g,sad.m_b);
saved = 1;
Invalidate(FALSE);
}
}
void CMyView::OnMld()
{
// TODO: Add your command handler code here
CSetAguDlg sad;
sad.SetStr("参数为255时,亮度不变,参数越小,亮度越低。");
if(sad.DoModal() == IDOK){
int i[1];
i[0] = sad.m_n;
bmp->CZ(5,i,sad.m_r,sad.m_g,sad.m_b);
saved = 1;
Invalidate(FALSE);
}
}
void CMyView::OnMenuitem32778()
{
// TODO: Add your command handler code here
bmp->DBD();
saved = 1;
Invalidate(FALSE);
}
void CMyView::OnMenuitem32779()
{
// TODO: Add your command handler code here
// bmp->SMXG();
bmp->NOT();
saved = 1;
Invalidate(FALSE);
}
void CMyView::OnMenuitem32780()
{
// TODO: Add your command handler code here
bmp->HDTX();
saved = 1;
Invalidate(FALSE);
}
void CMyView::OnMenuitem32781()
{
// TODO: Add your command handler code here
if(bmp->UnDoOK()){
bmp->UnDo();
saved = 1;
Invalidate();
// MessageBox("Un");
}
}
void CMyView::OnMenuitem32782()
{
// TODO: Add your command handler code here
if(bmp->ReDoOK()){
bmp->ReDo();
saved = 1;
Invalidate();
// MessageBox("Un");
}
// MessageBox("Re");
}
void CMyView::OnMenuitem32783()
{
// TODO: Add your command handler code here
if(bmp->pecol==bmp->bgcol){
MessageBox("前景色和背景色不同时进行此操作才有意义!");
return;
}
CSMSetDlg sms;
if(sms.DoModal()==IDOK){
bmp->SMXG(sms.m_bl,sms.m_bw,sms.dx,sms.dy);
saved = 1;
Invalidate(FALSE);
}
}
void CMyView::OnMenuitem32784()
{
// TODO: Add your command handler code here
if(bmp->pecol==bmp->bgcol){
MessageBox("前景色和背景色不同时进行此操作才有意义!");
return;
}
CMySetDlg msd;
if(msd.DoModal()==IDOK){
bmp->TEST(msd.m_m+1);
saved = 1;
Invalidate(FALSE);
}
}
void CMyView::OnMenuitem32785()
{
// TODO: Add your command handler code here
bmp->RH();
saved = 1;
Invalidate(FALSE);
}
void CMyView::OnMenuitem32786()
{
//缩放
CZoomSetDlg czsd(bmp->GetW(),bmp->GetH());
if(czsd.DoModal()==IDOK){
bmp->Zoom(czsd.m_w,czsd.m_h);
saved = 1;
Invalidate(TRUE);
}
}
void CMyView::OnMenuitem32787()
{
//平移
CMoveSetDlg czsd;
if(czsd.DoModal()==IDOK){
bmp->Move(czsd.m_r,czsd.m_d);
saved = 1;
Invalidate(FALSE);
}
}
void CMyView::OnMenuitem32788()
{
// TODO: Add your command handler code here
CTurnSetDLg ctsd;
if(ctsd.DoModal()==IDOK){
bmp->Turn(ctsd.m_d);
saved = 1;
Invalidate();
}
}
void CMyView::OnMenuitem32771()
{
// TODO: Add your command handler code here
ShellExecute(NULL,"open","help.doc",NULL,NULL,0);
}
void CMyView::OnMenuitem32790()
{
// TODO: Add your command handler code here
CZoomSetDlg czsd(bmp->GetW(),bmp->GetH());
if(czsd.DoModal()==IDOK){
bmp->Size(czsd.m_w,czsd.m_h);
saved = 1;
Invalidate();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -