📄 xba toolsdlg.cpp
字号:
if (m_c01=="COLOR09"){ m_i11=m_i01+2;m_i21=m_i01+3;}
if (m_c01=="COLOR10"){ m_i11=m_i01+1;m_i21=m_i01+1;}
if (m_c01=="COLOR11"){ m_i11=m_i01+0;m_i21=m_i01+0;}
if (m_c02=="COLOR01"){ m_i12=m_i02+40;m_i22=m_i02+55;}
if (m_c02=="COLOR02"){ m_i12=m_i02+32;m_i22=m_i02+39;}
if (m_c02=="COLOR03"){ m_i12=m_i02+25;m_i22=m_i02+31;}
if (m_c02=="COLOR04"){ m_i12=m_i02+19;m_i22=m_i02+24;}
if (m_c02=="COLOR05"){ m_i12=m_i02+14;m_i22=m_i02+18;}
if (m_c02=="COLOR06"){ m_i12=m_i02+10;m_i22=m_i02+13;}
if (m_c02=="COLOR07"){ m_i12=m_i02+7;m_i22=m_i02+9;}
if (m_c02=="COLOR08"){ m_i12=m_i02+4;m_i22=m_i02+6;}
if (m_c02=="COLOR09"){ m_i12=m_i02+2;m_i22=m_i02+3;}
if (m_c02=="COLOR10"){ m_i12=m_i02+1;m_i22=m_i02+1;}
if (m_c02=="COLOR11"){ m_i12=m_i02+0;m_i22=m_i02+0;}
if (m_c03=="COLOR01"){ m_i13=m_i03+40;m_i23=m_i03+55;}
if (m_c03=="COLOR02"){ m_i13=m_i03+32;m_i23=m_i03+39;}
if (m_c03=="COLOR03"){ m_i13=m_i03+25;m_i23=m_i03+31;}
if (m_c03=="COLOR04"){ m_i13=m_i03+19;m_i23=m_i03+24;}
if (m_c03=="COLOR05"){ m_i13=m_i03+14;m_i23=m_i03+18;}
if (m_c03=="COLOR06"){ m_i13=m_i03+10;m_i23=m_i03+13;}
if (m_c03=="COLOR07"){ m_i13=m_i03+7;m_i23=m_i03+9;}
if (m_c03=="COLOR08"){ m_i13=m_i03+4;m_i23=m_i03+6;}
if (m_c03=="COLOR09"){ m_i13=m_i03+2;m_i23=m_i03+3;}
if (m_c03=="COLOR10"){ m_i13=m_i03+1;m_i23=m_i03+1;}
if (m_c03=="COLOR11"){ m_i13=m_i03+0;m_i23=m_i03+0;}
if (m_c04=="COLOR01"){ m_i14=m_i04+40;m_i24=m_i04+55;if (m_i24>70){m_i24=70;}}
if (m_c04=="COLOR02"){ m_i14=m_i04+32;m_i24=m_i04+39;}
if (m_c04=="COLOR03"){ m_i14=m_i04+25;m_i24=m_i04+31;}
if (m_c04=="COLOR04"){ m_i14=m_i04+19;m_i24=m_i04+24;}
if (m_c04=="COLOR05"){ m_i14=m_i04+14;m_i24=m_i04+18;}
if (m_c04=="COLOR06"){ m_i14=m_i04+10;m_i24=m_i04+13;}
if (m_c04=="COLOR07"){ m_i14=m_i04+7;m_i24=m_i04+9;}
if (m_c04=="COLOR08"){ m_i14=m_i04+4;m_i24=m_i04+6;}
if (m_c04=="COLOR09"){ m_i14=m_i04+2;m_i24=m_i04+3;}
if (m_c04=="COLOR10"){ m_i14=m_i04+1;m_i24=m_i04+1;}
if (m_c04=="COLOR11"){ m_i14=m_i04+0;m_i24=m_i04+0;}
if (m_c05=="COLOR01"){ m_i15=m_i05+40;m_i25=m_i05+55;}
if (m_c05=="COLOR02"){ m_i15=m_i05+32;m_i25=m_i05+39;}
if (m_c05=="COLOR03"){ m_i15=m_i05+25;m_i25=m_i05+31;}
if (m_c05=="COLOR04"){ m_i15=m_i05+19;m_i25=m_i05+24;}
if (m_c05=="COLOR05"){ m_i15=m_i05+14;m_i25=m_i05+18;}
if (m_c05=="COLOR06"){ m_i15=m_i05+10;m_i25=m_i05+13;}
if (m_c05=="COLOR07"){ m_i15=m_i05+7;m_i25=m_i05+9;}
if (m_c05=="COLOR08"){ m_i15=m_i05+4;m_i25=m_i05+6;}
if (m_c05=="COLOR09"){ m_i15=m_i05+2;m_i25=m_i05+3;}
if (m_c05=="COLOR10"){ m_i15=m_i05+1;m_i25=m_i05+1;}
if (m_c05=="COLOR11"){ m_i15=m_i05+0;m_i25=m_i05+0;}
if (m_c06=="COLOR01"){ m_i16=m_i06+40;m_i26=m_i06+55;}
if (m_c06=="COLOR02"){ m_i16=m_i06+32;m_i26=m_i06+39;}
if (m_c06=="COLOR03"){ m_i16=m_i06+25;m_i26=m_i06+31;}
if (m_c06=="COLOR04"){ m_i16=m_i06+19;m_i26=m_i06+24;}
if (m_c06=="COLOR05"){ m_i16=m_i06+14;m_i26=m_i06+18;}
if (m_c06=="COLOR06"){ m_i16=m_i06+10;m_i26=m_i06+13;}
if (m_c06=="COLOR07"){ m_i16=m_i06+7;m_i26=m_i06+9;}
if (m_c06=="COLOR08"){ m_i16=m_i06+4;m_i26=m_i06+6;}
if (m_c06=="COLOR09"){ m_i16=m_i06+2;m_i26=m_i06+3;}
if (m_c06=="COLOR10"){ m_i16=m_i06+1;m_i26=m_i06+1;}
if (m_c06=="COLOR11"){ m_i16=m_i06+0;m_i26=m_i06+0;}
if (m_c07=="COLOR01"){ m_i17=m_i07+40;m_i27=m_i07+55;}
if (m_c07=="COLOR02"){ m_i17=m_i07+32;m_i27=m_i07+39;}
if (m_c07=="COLOR03"){ m_i17=m_i07+25;m_i27=m_i07+31;}
if (m_c07=="COLOR04"){ m_i17=m_i07+19;m_i27=m_i07+24;}
if (m_c07=="COLOR05"){ m_i17=m_i07+14;m_i27=m_i07+18;}
if (m_c07=="COLOR06"){ m_i17=m_i07+10;m_i27=m_i07+13;}
if (m_c07=="COLOR07"){ m_i17=m_i07+7;m_i27=m_i07+9;}
if (m_c07=="COLOR08"){ m_i17=m_i07+4;m_i27=m_i07+6;}
if (m_c07=="COLOR09"){ m_i17=m_i07+2;m_i27=m_i07+3;}
if (m_c07=="COLOR10"){ m_i17=m_i07+1;m_i27=m_i07+1;}
if (m_c07=="COLOR11"){ m_i17=m_i07+0;m_i27=m_i07+0;}
if (m_c08=="COLOR01"){ m_i18=m_i08+40;m_i28=m_i08+55;}
if (m_c08=="COLOR02"){ m_i18=m_i08+32;m_i28=m_i08+39;}
if (m_c08=="COLOR03"){ m_i18=m_i08+25;m_i28=m_i08+31;}
if (m_c08=="COLOR04"){ m_i18=m_i08+19;m_i28=m_i08+24;}
if (m_c08=="COLOR05"){ m_i18=m_i08+14;m_i28=m_i08+18;}
if (m_c08=="COLOR06"){ m_i18=m_i08+10;m_i28=m_i08+13;}
if (m_c08=="COLOR07"){ m_i18=m_i08+7;m_i28=m_i08+9;}
if (m_c08=="COLOR08"){ m_i18=m_i08+4;m_i28=m_i08+6;}
if (m_c08=="COLOR09"){ m_i18=m_i08+2;m_i28=m_i08+3;}
if (m_c08=="COLOR10"){ m_i18=m_i08+1;m_i28=m_i08+1;}
if (m_c08=="COLOR11"){ m_i18=m_i08+0;m_i28=m_i08+0;}
if (m_c09=="COLOR01"){ m_i19=m_i09+40;m_i29=m_i09+55;}
if (m_c09=="COLOR02"){ m_i19=m_i09+32;m_i29=m_i09+39;}
if (m_c09=="COLOR03"){ m_i19=m_i09+25;m_i29=m_i09+31;}
if (m_c09=="COLOR04"){ m_i19=m_i09+19;m_i29=m_i09+24;}
if (m_c09=="COLOR05"){ m_i19=m_i09+14;m_i29=m_i09+18;}
if (m_c09=="COLOR06"){ m_i19=m_i09+10;m_i29=m_i09+13;}
if (m_c09=="COLOR07"){ m_i19=m_i09+7;m_i29=m_i09+9;}
if (m_c09=="COLOR08"){ m_i19=m_i09+4;m_i29=m_i09+6;}
if (m_c09=="COLOR09"){ m_i19=m_i09+2;m_i29=m_i09+3;}
if (m_c09=="COLOR10"){ m_i19=m_i09+1;m_i29=m_i09+1;}
if (m_c09=="COLOR11"){ m_i19=m_i09+0;m_i29=m_i09+0;}
m_iCurr=(m_i01+m_i02+m_i03+m_i04+m_i05+m_i06+m_i07+m_i08+m_i09)/9;
m_iMin=(m_i11+m_i12+m_i13+m_i14+m_i15+m_i16+m_i17+m_i18+m_i19)/9;
m_iMax=(m_i21+m_i22+m_i23+m_i24+m_i25+m_i26+m_i27+m_i28+m_i29)/9;
//m_ChkSave=true;
UpdateData(false);
//CDialog::OnOK();
}
void CXBAToolsDlg::OnAbout()
{
// TODO: Add your control notification handler code here
CAboutDlg About;
About.DoModal();
}
void CXBAToolsDlg::OnCheckSave()
{
CRect oldWin;
CRect newWin;
UpdateData(true);
if(!m_ChkSave){
GetWindowRect(&oldWin);
newWin=oldWin;
newWin.right =oldWin.right -100;
//newWin.Width=oldWin.Width;
MoveWindow( &newWin , true );
}
else{
GetWindowRect(&oldWin);
newWin=oldWin;
newWin.right =oldWin.right +100;
//newWin.Width=oldWin.Width;
MoveWindow( &newWin , true );
}
UpdateData(false);
// TODO: Add your control notification handler code here
}
void CXBAToolsDlg::OnbSave()
{
// TODO: Add your control notification handler code here
FILE *fp_in,*fp_out;
int iPosFile;
char str_team[10],str_player[10];
char cor1[10],cor2[10],cor3[10],cor4[10],cor5[10],cor6[10],cor7[10],cor8[10],cor9[10];
int str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11,str12;
CString tmpMsg;
char c1;//,c2;
static BOOL isFind=false;
char str_tmp[200];
UpdateData(true);
if(m_TeamNo==""){
AfxMessageBox("没填写球队名称!");
return;
}
if(m_PlayerNo==""){
AfxMessageBox("没填写队员号码!");
return;
}
if ((fp_out=fopen("Player.txt","r"))==NULL){
isFind=false;
}
else{
fseek( fp_out, 0L, SEEK_SET );
while (!feof(fp_out)){
iPosFile=ftell(fp_out);
fscanf(fp_out,"%s %s %s %s %s %s %s %s %s %s %s %d %d %d %d %d %d %d %d %d %d %d %d%c",
str_team,str_player,cor1,cor2,cor3,cor4,cor5,cor6,cor7,cor8,cor9,
&str1,&str2,&str3,&str4,&str5,&str6,&str7,&str8,&str9,&str10,&str11,&str12,&c1);
if ((!strcmp(m_TeamNo,str_team))&&(!strcmp(m_PlayerNo,str_player)))
{
isFind=true;
break;
}
isFind=false;
}
fclose(fp_out);
}
if(!isFind){
if((fp_in = fopen("Player.txt","ab")) == NULL){
AfxMessageBox("打不开文件!");
return;
}
fprintf(fp_in,"%-10s %3s %s %s %s %s %s %s %s %s %s %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d%c%c",
m_TeamNo,m_PlayerNo,m_c01,m_c02,m_c03,m_c04,m_c05,m_c06,m_c07,m_c08,m_c09,
m_i01,m_i02,m_i03,m_i04,m_i05,m_i06,m_i07,m_i08,m_i09,m_iCurr,m_iMin,m_iMax,0x0D,0x0A);
fclose(fp_in);
AfxMessageBox("球员数据已保存!");
UpdateData(false);
fclose(fp_in);
return;
}
else{
if(AfxMessageBox("已存在该球员记录,您确定要更新么?",MB_YESNO)==IDYES){
if((fp_in = fopen("Player.txt","r+")) == NULL){
AfxMessageBox("打不开文件!");
return;
}
sprintf(str_tmp,"%-10s %3s %s %s %s %s %s %s %s %s %s %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d%c",
m_TeamNo,m_PlayerNo,m_c01,m_c02,m_c03,m_c04,m_c05,m_c06,m_c07,m_c08,m_c09,
m_i01,m_i02,m_i03,m_i04,m_i05,m_i06,m_i07,m_i08,m_i09,m_iCurr,m_iMin,m_iMax,&c1);
fseek( fp_out, iPosFile, SEEK_SET );
fwrite( str_tmp, sizeof(char), 134, fp_in );
fclose(fp_in);
AfxMessageBox("球员数据已更新!");
UpdateData(false);
fclose(fp_in);
}
return;
}
}
void CXBAToolsDlg::OnbLoad()
{
// TODO: Add your control notification handler code here
FILE *fp_out;
UpdateData();
int iPosFile;
CString tmpMsg;
char str_team[10],str_player[10];
char c1;//,c2;
//char str_tmp[137];
char cor1[10],cor2[10],cor3[10],cor4[10],cor5[10],cor6[10],cor7[10],cor8[10],cor9[10];
int str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11,str12;
if(m_TeamNo==""){
AfxMessageBox("请输入球队名称!");
return;
}
if(m_PlayerNo==""){
AfxMessageBox("没输入队员号码!");
return;
}
if ((fp_out=fopen("Player.txt","r"))==NULL){
AfxMessageBox("没找到球员记录文件!");
return;
}
fseek( fp_out, 0L, SEEK_SET );
while (!feof(fp_out)){
iPosFile=ftell( fp_out);
//tmpMsg.Format("%d",iPosFile);
//AfxMessageBox(tmpMsg);
fscanf(fp_out,"%s %s %s %s %s %s %s %s %s %s %s %d %d %d %d %d %d %d %d %d %d %d %d%c",
str_team,str_player,cor1,cor2,cor3,cor4,cor5,cor6,cor7,cor8,cor9,
&str1,&str2,&str3,&str4,&str5,&str6,&str7,&str8,&str9,&str10,&str11,&str12,&c1);
if ((!strcmp(m_TeamNo,str_team))&&(!strcmp(m_PlayerNo,str_player)))
{
m_c01=cor1;
m_c02=cor2;
m_c03=cor3;
m_c04=cor4;
m_c05=cor5;
m_c06=cor6;
m_c07=cor7;
m_c08=cor8;
m_c09=cor9;
m_i01=str1;
m_i02=str2;
m_i03=str3;
m_i04=str4;
m_i05=str5;
m_i06=str6;
m_i07=str7;
m_i08=str8;
m_i09=str9;
m_iCurr=str10;
m_iMin=str11;
m_iMax=str12;
fclose(fp_out);
UpdateData(false);
AfxMessageBox("找到队员!");
return;
}
}
fclose(fp_out);
AfxMessageBox("没找到队员!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -