用户
 找回密码
 立即注册

40

主题

340

帖子

1496

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1496
发表于 2016-2-18 11:55:39
           2015年初,基于smobiler平台开发的coms管理系统上线了,这套系统主要是方便大家快速,便捷的报销的。在一年的使用中,大家对这套系统也越来越肯定了,在这一年中,大家提出了很多的新功能新要求。这不,2015年12月底,把这些建议通通收集起来,领导就和大家一起开会讨论,最后敲定了新加请假、签到、日志、周报等功能。虽然2015年底就确定了新功能了,由于我在做其他项目,而这个项目的开发一直也是我来做的,所以只好等待其他项目做完,在来新加这些功能了。
      等待等待......
      2016年2月16号老大就要求完善coms管理系统的新功能了,于是重新把之前的功能要求研究下,现在就开始动手开发新功能了。首先就开始来做请假功能,做请假功能时候首先我考虑到了风格的统一问题,新加的功能一定要和以前的报销等功能一致,不然看上去会觉得很不舒服。
      先来一张工具箱的截图。
   
      现在来做请假功能第一个界面,请假条创建。通过拖拉工具箱中的lable、textbox和button等控件,并分别对控件进行简单布局。一个请假条创建界面就设计好了。

请假条创建界面的标题如何来设计的了,将窗体的TitleText属性赋值,在将窗体的TitleBackColor属性设置为DeepSkyBlue颜色



接下来设计窗体保存按钮,这里我将保存和返回按钮设计在底部。


现在就可以看到客户端的显示效果。




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
分享至 : QQ空间
0 人收藏
使用道具 举报 回复
发表于 2016-2-29 10:31:29
Csharp 发表于 2016-2-27 11:05
请问一下,请问一下请假条创建,布局是用的什么控件。

请假条创建布局的控件有lable、Textbox、Button、DatePicker、Poplist、Camera和ImageButton
使用道具 举报 回复 支持 1 反对 0
发表于 2016-2-18 15:22:28
请假的设计界面完成了,如何实现类别选择和审批人抄送人选择。
拖拉一个PopList控件。双击审批人按钮控件,进入事件,这里贴一张事件代码
  1. //获取审批人或抄送人
  2.         private void BtnCUser_Click(object sender, EventArgs e)
  3.         {
  4.             //获取审批人或抄送人
  5.             btn = sender;
  6.             //获取数据
  7.             LeaveInfo Leave = new LeaveInfo();
  8.             DataTable table = Leave.GetConfirmUser();
  9.             PopList1.Groups.Clear();
  10.             PopListGroup poli = new PopListGroup();
  11.             PopList1.Groups.Add(poli);

  12.             switch (((Button)sender).Name)
  13.             {
  14.                 case "BtnCUser":
  15.                 case "BtnCUser2":
  16.                     PopList1.MultiSelect = false;
  17.                     poli.Text = "审批人";
  18.                     break;
  19.                 case "Btnccuser2":
  20.                 case "Btnccuser1":
  21.                     PopList1.MultiSelect = true;
  22.                     poli.Text = "抄送人";
  23.                     break;
  24.             }
  25.             //显示选择列表中key和values
  26.             foreach (DataRow rowli in table.Rows)
  27.             {
  28.                 poli.Items.Add(rowli["USER_ID"].ToString(), rowli["USER_ID"].ToString());
  29.                 switch (((Button)sender).Name)
  30.                 {
  31.                     case "BtnCUser":
  32.                     case "BtnCUser2":
  33.                         if (CUser.Trim().Length > 0)
  34.                         {
  35.                             if (CUser.Trim().ToUpper() == rowli["USER_ID"].ToString().Trim().ToUpper())
  36.                             {
  37.                                 PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
  38.                             }
  39.                         }
  40.                         break;
  41.                     case "Btnccuser2":
  42.                     case "Btnccuser1":
  43.                         if (CCUser.Trim().Length > 0)
  44.                         {
  45.                             if (CCUser.Trim().ToUpper() == rowli["USER_ID"].ToString().Trim().ToUpper())
  46.                             {
  47.                                 PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
  48.                             }
  49.                         }
  50.                         break;
  51.                 }
  52.             }
  53.             PopList1.Show();
  54.         }
复制代码

poplist选择后赋值代码
  1. /// <summary>
  2.         /// PopList的审批人,抄送人赋值
  3.         /// </summary>
  4.         /// <param name="sender"></param>
  5.         /// <param name="e"></param>
  6.         private void PopList1_Selected(object sender, EventArgs e)
  7.         {

  8.             try
  9.             {
  10.                 switch (((Button)btn).Name)
  11.                 {
  12.                     case "BtnCUser":
  13.                     case "BtnCUser2":
  14.                         if (PopList1.Selection != null)
  15.                         {
  16.                             CUser = PopList1.Selection.Value;
  17.                             this.BtnCUser.Text = PopList1.Selection.Text.Trim();
  18.                         }
  19.                         break;
  20.                     case "Btnccuser2":
  21.                     case "Btnccuser1":
  22.                         if (PopList1.Selections != null)
  23.                         {
  24.                             CCUser = "";
  25.                             foreach (PopListItem poitem in PopList1.Selections)
  26.                             {
  27.                                 if (CCUser.Length > 0)
  28.                                 {
  29.                                     CCUser += "," + poitem.Value;
  30.                                 }
  31.                                 else
  32.                                 {
  33.                                     CCUser = poitem.Value;
  34.                                 }
  35.                             }
  36.                             if (CCUser.Length > 0)
  37.                             {
  38.                                 this.Btnccuser1.Text = CCUser;
  39.                             }
  40.                         }
  41.                         break;
  42.                 }

  43.             }
  44.             catch (Exception ex)
  45.             {
  46.                 MessageBox.Show(ex.Message);
  47.             }
  48.         }
复制代码

请假条创建界面的功能基本完成了,接下来就是对界面输入数据保存了。这里是通过ToolbarItemClick事件,具体代码如下:
  1. /// <summary>
  2.         /// toolbar事件
  3.         /// </summary>
  4.         /// <param name="sender"></param>
  5.         /// <param name="e"></param>
  6.         private void frmLeaveCreate_ToolbarItemClick(object sender, ToolbarClickEventArgs e)
  7.         {
  8.             try
  9.             {
  10.                 if (e.Name.Equals(tExit.Name))
  11.                 {
  12.                     MessageBox.Show("是否确定返回?", MessageBoxButtons.YesNo, (Object s, MessageBoxHandlerArgs args) =>
  13.                     {
  14.                         if (args.Result == Smobiler.Core.ShowResult.Yes)
  15.                         {
  16.                             this.Close();
  17.                         }
  18.                     }
  19.                     );

  20.                 }
  21.                 else if (e.Name.Equals(save.Name))
  22.                 {
  23.                     if (LDAY.Text.Length < 0)
  24.                     {
  25.                         throw new Exception("请输入请假天数!");
  26.                     }
  27.                     if (int.Parse(LDAY.Text) <= 0)
  28.                     {
  29.                         throw new Exception("请假天数必须大于0!");
  30.                     }
  31.                     if (LREASON.Text.Length < 0)
  32.                     {
  33.                         throw new Exception("请输入请假事由!");
  34.                     }
  35.                     MessageBox.Show("请假条创建成功!", (Object s, MessageBoxHandlerArgs args) =>
  36.                     {
  37.                         ShowResult = Smobiler.Core.ShowResult.Yes;
  38.                     });
  39.                 }
  40.             }
  41.             catch (Exception ex)
  42.             {
  43.                 MessageBox.Show(ex.Message);
  44.             }
  45.         }
复制代码





使用道具 举报 回复 支持 反对
发表于 2016-2-18 16:16:28
赞!
使用道具 举报 回复
发表于 2016-2-27 11:05:13
请问一下,请问一下请假条创建,布局是用的什么控件。
使用道具 举报 回复 支持 反对
发表于 2016-7-5 10:05:24
支持一下
使用道具 举报 回复
发表于 2021-2-13 22:19:23
我用了保存的图片 ios-save,运行出来是个钥匙形,怪不怪!
使用道具 举报 回复 支持 反对
发表于 2021-2-13 22:49:46
这条语句e.Name.Equals(tExit.Name) tExit下有波浪线,显示上下文没有这个变量,是什么原因?
使用道具 举报 回复 支持 反对
发新帖
您需要登录后才可以回帖 登录 | 立即注册