目录
一、项目背景。
随着互联网的快速发展,个人兴趣爱好已成为人们生活的重要组成部分。为了更好地了解和服务于这一用户群体,我们决定开发一个专门针对兴趣爱好调查的博客系统。该系统旨在提供一个平台,让用户可以轻松地创建、分享和讨论他们的兴趣爱好,同时收集有价值的数据进行分析。
二、美化功能。
1.在visual Studio软件里面的工具点击NuGet包管理器再选中管理解决方案的NuGet程序包。进去再搜索SunnyUI,再安装。
2.这是安装成功的页面和成功后会在工具箱里面看到SunnyUI。
三、创建项目。
启动Visudio,创建一个Windows窗体应用程序,命名为HubbiesSurvery。
四、添加控件。
接下来将该窗体设计为兴趣爱好调查界面。本案例实现的兴趣爱好调查界面需要1个标签控件(uiLabell),1个文本控件(uiText),2个标签平滑(uiSmoothLabell),2个平滑按钮(uiSmoothbutton),1个控件(UiComboBox1),6个下拉选择框(UiGroupBox4),1个读控件(UireadioButton)
五、设置控件属性。
添加完控件之后,需要为各控件设置相应的属性。选中要设置属性的控件,在“属性”面板中修改相应属性的值即可。也可以右击该控件,在弹出的快捷菜单中选中”属性”命令进入“属性”面板(如果“属性”面板关闭了,可通过选择“视图”→“属性窗口”命令打开“属性”面板)。为控件设置属性如下:
控件 | 属性 | 属性值 |
Form1 | Text | 爱好调查 |
uiSmoothLabell1 | Text | 兴趣爱好调查 |
UismoothButton1 | Text | 取消 |
UismoothButton2 | Text | 确定 |
UiLabel1 | Text | 班级: |
UiComboBox1 | Text | |
UiGroupBox1 | Text | 爱好 |
UiGroupBox1 | Text | KTV |
UiGroupBox1 | Text | 学习 |
UiGroupBox2 | Text | 美食 |
UiGroupBox3 | Text | 旅游 |
UiGroupBox4 | Text | |
UireadioButton | Text | 性别: |
uiSmoothLabel1 | Text | 调查结果 |
uiTextBox1 | Text | |
uiTextBox1 | Text |
六、编写源代。
双击兴趣爱好调查系统的“取消”和“确定”,进入源代码编写窗口,系统将自动进入“取消”“确定”按钮创建一个Click事件函数,名称为uiSymbolButtonCancel_Click和uiSymbolButtonOK_Click。
public partial class Form1 : UIForm
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.uiRadioButtonGroupSex.Items.AddRange(new object[]
{
"男",
"女",
});
init();
private void uiSymbolButtonCancel_Click(object sender, EventArgs e)
{
init();
}
private void init()
{
this.uiTextBoxName.Text = "";
this.uiRadioButtonGroupSex.SelectedIndex = 0;
this.uiComboBoxClass.SelectedIndex = 0;
this.uiCheckBoxFood.Checked = false;
this.uiCheckBoxKTV.Checked = false;
this.uiCheckBoxtrip.Checked = false;
this.uiCheckBoxstudy.Checked = false;
}
private void uiSymbolButtonOK_Click(object sender, EventArgs e)
{
String name = this.uiTextBoxName.Text.Trim();
String sex = this.uiRadioButtonGroupSex.SelectedIndex == 0 ? "男" : "女";
String strClass = this.uiComboBoxClass.SelectedItem.ToString();
String hobbies = "";
if(this.uiCheckBoxKTV.Checked==true)
{
hobbies += "KTV";
}
if (this.uiCheckBoxstudy.Checked == true)
{
hobbies += "学习";
}
if (this.uiCheckBoxtrip.Checked == true)
{
hobbies += "旅游";
}
if (this.uiCheckBoxFood.Checked == true)
{
hobbies += "美食";
}
UIMessageBox.ShowSuccess("提交成功! !");
String result = "姓名:" + name + "\r\n"
+ "性别:" + sex + "\r\n"
+ "班级:" + strClass + "\r\n"
+ "爱好:" + hobbies;
ResultForm resultForm = new ResultForm(result);
resultForm.ShowDialog();
}
}
七、添加类。
1.选中兴趣爱好调查,单击鼠标右键,选择添加,点击类,如图所示,
2.选择窗体(widows)窗体,命名为ResultForm,再选添加A即可。
3.类的代码如下:
public partial class ResultForm : UIForm
{
public ResultForm(String result)
{
InitializeComponent();
this.uiTextBoxResult.Text = result;
}
}
八、运行程序。
源代码编写完成后,保存项目文件并运行程序,程序运行效果。
九、总结与展望。
展望:
功能扩展: 我们计划增加更多的社交功能,如同学之间的互动和内容分享,以增强校园的凝聚力。
数据分析深化: 利用收集到的数据,我们将开展更深入的数据分析,为用户提供更个性化的内容推荐和服务。
移动应用开发: 考虑到用户的移动使用习惯,我们将开发移动应用,提供更加便捷的访问体验。
国际市场拓展: 随着系统的成熟,我们将探索将系统推向国际市场,服务于全球用户。
结语:
通过本次项目实践,我们深刻体会到了技术选择对项目成功的重要性。Visual Studio为我们提供了强大的开发支持,而Bootstrap和Chart.js等库则帮助我们快速实现了用户友好的界面和数据可视化。未来,我们将继续探索新技术,不断提升我们的技术栈,以适应不断变化的市场需求和用户期望。