⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yszmrkdlg.cpp

📁 这是一套学校设备管理系统的源码 里面有树形结构使用的很棒的方法
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		for (i=0;i<l;i++){
	      if (((buf[i] < '0')||(buf[i] > '9'))&&(buf[i] != '.')){
		    buf[i] = 0;
	        SetDlgItemText(IDC_wpdj,buf);
			Set_to_item_end(this,IDC_wpdj);
		  }
		}
        l = strlen(buf);
		flag = 0;
		for (i=0;i<l;i++){
			if (buf[i] == '.'){
				j = i;
				flag = 1;
				break;
            }
        }
		if (flag == 1){
			if (j < l-3){
				buf[j+3] = 0;
	            SetDlgItemText(IDC_wpdj,buf);
			    Set_to_item_end(this,IDC_wpdj);
            } 
        }
	}
/*
	    strcpy(buff,buf);
//	    if (g_lock_count_flag == 0){
//	      g_lock_count_flag = 1;
	      GetDlgItemText(IDC_wpsl,buf,40);
	      sl = atof(buf);
	      GetDlgItemText(IDC_wpdj,buf,40);
	      dj = atof(buf);
	      zje = sl*dj;
	      sprintf(buf,"%#.2lf",zje);
		  if (strlen(buf) > 12){
            buff[l-1] = 0;
            p_mod_wpdj = 1;
	        SetDlgItemText(IDC_wpdj,buff);
			Set_to_item_end(this,IDC_wpdj);
          }
		  else{
			  if (fabs(zje) > 0.001){
                p_mod_zje = 1;
	            SetDlgItemText(IDC_zje,buf);
			  }
          }
//	      g_lock_count_flag = 0;
//		}
	}
*/
}

void Cyszmrkdlg::OnChangebyjx() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	char buf[20];
	int i;

	if (g_yszm_xzsb_flag == 0){
	  GetDlgItemText(IDC_byjx,buf,20);
	  Cyszmxzsbdlg dlg;
	  g_yszm_xzsb_flag = 1;
	  g_xzxzsb_flag = 1;
      strcpy(g_yszm_xzsb_pass_buf,buf);
	  if (dlg.DoModal() == IDOK){
	    g_xzxzsb_flag = 0;
		i = g_yszm_sel_sb;
	    g_yszm_xzsb_flag = 1;
		SetDlgItemText(IDC_byjx,g_e_abbr[i]);
		SetDlgItemText(IDC_sbmc,g_e_name[i]);
        g_yszm_xzsb_flag = 1;
		SetDlgItemText(IDC_gdbh,g_a_id[i]);
		SetDlgItemText(IDC_yqdm,g_e_code[i]);
		SetDlgItemText(IDC_scdm,g_p_id[i]);

	    m_tree.SelectDropTarget(g_htreeitem[i]);
	    m_tree.SelectItem(g_htreeitem[i]);

		if ((strstr(g_e_name[i],"其他") != NULL)||
			(strstr(g_e_name[i],"其它") != NULL)){
	      CWnd *wnd;
	      wnd = GetDlgItem(IDC_sbmc);
		  SetDlgItemText(IDC_sbmc,"");
	      wnd->SetFocus();
		}
		else{
	      CWnd *wnd;
	      wnd = GetDlgItem(IDC_rkfs);
	      wnd->SetFocus();
		}
	  }
	  else{
	    g_xzxzsb_flag = 0;
      }
	}
	else{
      g_yszm_xzsb_flag = 0;
    }
}

void Cyszmrkdlg::OnSelchangingTree1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	// TODO: Add your control notification handler code here
	*pResult = 0;
}

void Cyszmrkdlg::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	// TODO: Add your control notification handler code here
	HTREEITEM htreeitem;
	int i,j;
	char buf[100];
	CString str;

	htreeitem = m_tree.GetSelectedItem();
	if (htreeitem != NULL){
	  for (j=0;j<g_end_sbs;j++){
		if (g_htreeitem[j] == htreeitem){
			i = j;
			break;
        }
	  }

      g_yszm_sel_sb = i; 

	  if ((strstr(g_e_name[i],"其他") == NULL)&&
	      (strstr(g_e_name[i],"其它") == NULL)){
	  for (i=0;i<g_end_sbs;i++){
		if (g_parent[i] == g_yszm_sel_sb){
	      *pResult = 0;
		  return;
        }
	  } 
	  }

	  i = g_yszm_sel_sb;
	  m_tree.SelectDropTarget(g_htreeitem[i]);
	  m_tree.SelectItem(g_htreeitem[i]);
	  g_yszm_xzsb_flag = 1;
      SetDlgItemText(IDC_byjx,g_e_abbr[i]);
	  SetDlgItemText(IDC_sbmc,g_e_name[i]);
      g_yszm_xzsb_flag = 1;
	  SetDlgItemText(IDC_gdbh,g_a_id[i]);
	  SetDlgItemText(IDC_yqdm,g_e_code[i]);
	  SetDlgItemText(IDC_scdm,g_p_id[i]);
    }
	*pResult = 0;
}


void Cyszmrkdlg::OnEditchangerkfs() 
{
	// TODO: Add your control notification handler code here
	char buf[20];

	GetDlgItemText(IDC_rkfs,buf,20);
	if (buf[0] != 0){
	  if (m_rkfs.SelectString(0,buf) == CB_ERR){
		SetDlgItemText(IDC_rkfs,"");
	  }
	}
}

void Cyszmrkdlg::OnEditchangessbm() 
{
  char buf[50];

  if (update_ssbm_flag == 0){
	GetDlgItemText(IDC_ssbm,buf,20);
	Cxzbm1dlg dlg;
    strcpy(g_xzbm_pass_buf,buf);
	if (dlg.DoModal() == IDOK){
        update_ssbm_flag = 1;
		SetDlgItemText(IDC_ssbm,g_xzbm);
    }
  }
  else{
	  update_ssbm_flag = 0;
  }
}

void Cyszmrkdlg::OnChangecjpp() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	char buf[50];

	GetDlgItemText(IDC_cjpp,buf,50);
	if (strlen(buf) > 20){
		buf[20] = 0;
		SetDlgItemText(IDC_cjpp,buf);
		Set_to_item_end(this,IDC_cjpp);
    }
	
}

void Cyszmrkdlg::OnChangeghdw() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	char buf[50];

	GetDlgItemText(IDC_ghdw,buf,50);
	if (strlen(buf) > 20){
		buf[20] = 0;
		SetDlgItemText(IDC_ghdw,buf);
		Set_to_item_end(this,IDC_ghdw);
    }
	
}

void Cyszmrkdlg::OnChangexhgg() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	char buf[50];

	GetDlgItemText(IDC_xhgg,buf,50);
	if (strlen(buf) > 20){
		buf[20] = 0;
		SetDlgItemText(IDC_xhgg,buf);
		Set_to_item_end(this,IDC_xhgg);
    }
}

void Cyszmrkdlg::OnEditchangerkn() 
{
	// TODO: Add your control notification handler code here
	char buf[40];

	int l,i,flag,j;
	
	GetDlgItemText(IDC_rkn,buf,12);
    l = strlen(buf);
	if (l > 0){
		if (l > 4){
			buf[4] = 0;
	        SetDlgItemText(IDC_rkn,buf);
        }
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
			if (i == 0){
				strcpy(buf,"2000");
			}
			else
		      buf[i] = 0;
	        SetDlgItemText(IDC_rkn,buf);
			Set_to_item_end(this,IDC_rkn);
		  }
		}
	}
}

void Cyszmrkdlg::OnEditchangerkr() 
{
	// TODO: Add your control notification handler code here
	char buf[40];

	int l,i,flag,j;
	
	GetDlgItemText(IDC_rkr,buf,12);
    l = strlen(buf);
	if (l > 0){
		if (l > 2){
			buf[2] = 0;
	        SetDlgItemText(IDC_rkr,buf);
			Set_to_item_end(this,IDC_rkr);
        }
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
			if (i == 0){
				strcpy(buf,"15");
			}
			else
		      buf[i] = 0;
	        SetDlgItemText(IDC_rkr,buf);
			Set_to_item_end(this,IDC_rkr);
		  }
		}
	}
}

void Cyszmrkdlg::OnEditchangerky() 
{
	// TODO: Add your control notification handler code here
	char buf[40];

	int l,i,flag,j;
	
	GetDlgItemText(IDC_rky,buf,12);
    l = strlen(buf);
	if (l > 0){
		if (l > 2){
			buf[2] = 0;
	        SetDlgItemText(IDC_rky,buf);
			Set_to_item_end(this,IDC_rky);
        }
		for (i=0;i<l;i++){
	      if ((buf[i] < '0')||(buf[i] > '9')){
			if (i == 0){
				strcpy(buf,"6");
			}
			else
		      buf[i] = 0;
	        SetDlgItemText(IDC_rky,buf);
			Set_to_item_end(this,IDC_rky);
		  }
		}
	}
}

void Cyszmrkdlg::OnChangesbmc() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	char buf[50];

	GetDlgItemText(IDC_sbmc,buf,50);
	if (strlen(buf) > 40){
		buf[40] = 0;
		SetDlgItemText(IDC_sbmc,buf);
		Set_to_item_end(this,IDC_sbmc);
    }
	g_yszm_xzsb_flag = 1;
    SetDlgItemText(IDC_byjx,"");
}

void Cyszmrkdlg::OnEditchangejbr() 
{
	// TODO: Add your control notification handler code here
	char buf[20];

	GetDlgItemText(IDC_jbr,buf,20);
	if (strlen(buf) > 10){
		buf[10] = 0;
		SetDlgItemText(IDC_jbr,buf);
		Set_to_item_end(this,IDC_jbr);
    }	
}


void Cyszmrkdlg::OnSetfocuswpdj() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_wpdj);
	switch_to_english_mode(wnd);	
	cur_focus = 7;
    order_of_wpdj ++;

	double sl,zje,dj;
	char buf[30];

    GetDlgItemText(IDC_wpsl,buf,20);
	sl = atof(buf);
    GetDlgItemText(IDC_zje,buf,20);
	zje = atof(buf);
	if (fabs(sl) > 0.001){
	  dj = zje / sl;
	  sprintf(buf,"%.2lf",dj);
	  if (fabs(zje) > 0.01)
	    SetDlgItemText(IDC_wpdj,buf);
	}
}

void Cyszmrkdlg::OnSetfocuswpsl() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_wpsl);
	switch_to_english_mode(wnd);	
	cur_focus = 8;
	order_of_wpsl ++;
}

void Cyszmrkdlg::OnSetfocusxhgg() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_xhgg);
	switch_to_english_mode(wnd);	
	cur_focus = 6;
}

void Cyszmrkdlg::OnSetfocussbmc() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_sbmc);
	switch_to_chinese_mode(wnd);	
	cur_focus = 2;
}

void Cyszmrkdlg::OnSetfocusrkn() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_rkn);
	switch_to_english_mode(wnd);	
	cur_focus = 15;
}

void Cyszmrkdlg::OnSetfocusrkr() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_rkr);
	switch_to_english_mode(wnd);	
	cur_focus = 17;
}

void Cyszmrkdlg::OnSetfocusrky() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_rky);
	switch_to_english_mode(wnd);
	cur_focus = 16;
}

void Cyszmrkdlg::OnSetfocusjbr() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_jbr);
	switch_to_chinese_mode(wnd);	
	cur_focus = 10;
}

void Cyszmrkdlg::OnSetfocusghdw() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_ghdw);
	switch_to_chinese_mode(wnd);	
	cur_focus = 11;
}

void Cyszmrkdlg::OnSetfocuscjpp() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;

	wnd = GetDlgItem(IDC_cjpp);
	switch_to_chinese_mode(wnd);	
	cur_focus = 5;
}

void Cyszmrkdlg::OnSetfocuszje() 
{
	// TODO: Add your control notification handler code here
	CWnd *wnd;
	double sl,zje,dj,ozje;
	double jfxs,yzf,xxhf,sjhf;
	char buf[30];

	wnd = GetDlgItem(IDC_zje);
	switch_to_english_mode(wnd);	
	cur_focus = 9;

    GetDlgItemText(IDC_zje,buf,20);
	ozje = atof(buf);
    GetDlgItemText(IDC_wpsl,buf,20);
	sl = atof(buf);
    GetDlgItemText(IDC_wpdj,buf,20);
	dj = atof(buf);
	zje = dj*sl;
	sjhf = xxhf = 0;
	if (fabs(zje-ozje) > sl*0.01){
	  sprintf(buf,"%.2lf",zje);
	  if (fabs(dj) > 0.01){
	    SetDlgItemText(IDC_zje,buf);
/*
	    if (g_zm_chaxun_flag != YSZM){
          GetDlgItemText(IDC_jfxs,buf,10);
	      jfxs = atof(buf);
          GetDlgItemText(IDC_yzf,buf,10);
	      yzf = atof(buf);
 	      xxhf += yzf + zje*jfxs/100.;
	      sjhf += zje*(100-jfxs)/100.;
	      sprintf(buf,"%.2lf",xxhf);
	      SetDlgItemText(IDC_xxhf,buf);
	      sprintf(buf,"%.2lf",sjhf);
	      SetDlgItemText(IDC_sjhf,buf);
		} 
*/
	  }
	}

}

void Cyszmrkdlg::OnOK() 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -