将变量值导入/导出到文件 [英] Import/ export variables values to a file

查看:60
本文介绍了将变量值导入/导出到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上有

将a设为两倍

将b设为两倍

我也有一些文本框,用户可以在其中为上述变量分配任何值

使用按钮我想导出/保存这些值,然后使用另一个按钮将这些值加载/导入到相同的变量中(即使我关闭程序,然后再运行它)

问题2:我有一个进度条i,我在需要时设法将其颜色更改为红色,黄色……但是绿色是唯一使光泽滑动效果"变为红色的颜色.在酒吧上,为什么?我的意思是其他颜色都是扁平的,没有任何颜色 动画...

解决方案

使用按钮我想导出/保存这些值,然后使用另一个按钮将这些值加载/导入到相同的变量中(即使我关闭程序,然后再运行它)

最简单的选择是将文本框值绑定到用户设置.用户设置会在程序关闭时自动保存到文件中,并在程序启动时自动重新加载.您可以使用以下代码保存/恢复它们: 你想要的.

在设计器中,选择文本框,然后在属性"窗格中,展开(应用程序设置),然后选择(属性绑定).点击...标签以打开编辑器.默认情况下将选择文本.打开下拉菜单,选择新建,然后 输入唯一的名称. OK OK.

我有一个进度条,我随时可以将其颜色更改为红色,黄色...,但是绿色是唯一一种使光泽滑动效果"变为红色的颜色.在酒吧上,为什么?我的意思是其他颜色都是平的,没有任何动画 ...

请不要在一个线程中询问多个问题-这会使最终的对话变得过于复杂.在新主题中发布第二个问题.

有关ProgressBar的详细信息,请参见: https://msdn.microsoft.com/zh-CN/library/system.windows.forms.progressbar(v=vs.110).aspx
尤其是注释" ForeColor 在Windows XP Home Edition,Windows XP Professional,Windows Server 2003及更高版本上启用视觉样式时,将不接受 ProgressBar BackColor 更改.



Hi, i have basicly

dim a as double

dim b as double

i also have some textboxes in which user can assign any value to the variables mentioned above

with a button i want to export/save these values and then with another button load/import these values to the same variables ( even if i close the program and then run it later)

question 2 :i have a progress bar i which i managed to change its color to red, yellow whenever i want ... but green color is the only color that makes the "shiny sliding effect" on the bar, why? i mean the other colors are just flat without any animation ...

解决方案

with a button i want to export/save these values and then with another button load/import these values to the same variables ( even if i close the program and then run it later)

The simplest option is to bind the text box values to a user setting.   User settings are automatically saved to file when a program closes, and automatically re-loaded when the program starts.  You can save/restore them using code if you want.

In the designer, select the text box, and in the Properties pane expand the (Application Settings) and select (Property Binding).  Click ... tab to open the editor.  Text will be selected by default.  Open the dropdown, select New and enter a unique name.  OK OK.

i have a progress bar i which i managed to change its color to red, yellow whenever i want ... but green color is the only color that makes the "shiny sliding effect" on the bar, why? i mean the other colors are just flat without any animation ...

Please don't ask multiple questions in one thread - it makes the resulting conversation too complicated.  Post your second question in a new thread.

For ProgressBar details see: https://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar(v=vs.110).aspx
and in particular the note "ForeColor and BackColor changes for the ProgressBar will not be honored when visual styles are enabled on Windows XP Home Edition, Windows XP Professional, Windows Server 2003 and above."



这篇关于将变量值导入/导出到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆