问题描述
大家好.
我正在为游戏设计计算器.因此,我决定尝试对计算器进行编码,以使其尽可能地易于使用.
我需要帮助的是以下内容;
根据按钮更改其他窗体的效果,请单击主窗体.
示例;
如果我有两种形式,MainForm和SubForm.在MainForm中,我有一个文本框txtTotal,两个按钮btnAdd和btnSubtract.
在子窗体中,我有一个名为txtValue的文本框,两个按钮btnOK和btnCancel.
如果单击了MainForm中的btnAdd,则将单击子窗体加载",并且单击btnOK时,txtValue的值将添加到txtTotal中.
所以txtTotal已经具有5的值,在txtValue(来自SubForm)中,我另外输入了5并单击确定"-txtTotal现在将其值更改为10.
但是,如果单击btnSubtract,则单击btnOK时,将加载SubForm Loads,并且从txtTotal中减去txtValue的值.
所以如果SubForm.txtValue和MainForm.txtTotal为5,则txtTotal现在将为0.
还想知道如何更改依赖于MainForm btns的图像.例如,btnAdd会将SubForm的背景设置为"C:\ Some location",而btnSubtract会将SubForm的背景设置为"C:\ Some other Location"
你们当中有人知道关于类和效果指南的有用链接吗? :)
Hello Everyone.
I''m working on a Calculator for a game. So i decided to try to code the calculator to be as user friendly as possible.
What i need help with is the following;
Changing the effects of another form dependent on the button i click on my mainform.
Example;
If i have two forms, MainForm and SubForm. In the MainForm i have a textbox, txtTotal, two buttons, btnAdd and btnSubtract.
In the SubForm i have a Textbox, named txtValue, two buttons, btnOK and btnCancel.
If the btnAdd from the MainForm is clicked, SubForm Loads and the value of txtValue will be ADD to the txtTotal when the btnOK is clicked.
So e.g. txtTotal already have a value of 5, in txtValue(from SubForm) i put in an additional 5 and hit ok - txtTotal will now change its value to 10.
However if the btnSubtract is clicked, SubForm Loads and the value of txtValue will be Subtracted from the txtTotal when the btnOK is clicked.
So e.g. txtTotal will now be 0, if SubForm.txtValue and MainForm.txtTotal is 5.
Also would like to know how to change a image dependent on MainForm btns. Example the btnAdd will set the background of SubForm to "C:\Some location" and the btnSubtract will set the background of SubForm to "C:\Some other Location"
also does any of you know any useful links to a guide about Class''s and effects ? :)
推荐答案
这篇关于表单功能.需要帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!