C# :: How To Get AI To Look For Specific Buttons
May 5, 2014
Basically I am creating a game and I need the ai to look for specific buttons. At the moment this is the code I have, and what it does is it makes the ai look for any random button that has't already been clicked.
Code:
private Button look_for_spaces() {
Console.WriteLine("Looking for spaces");
Button b = null;
foreach (Control c in Controls) {
b = c as Button; // performs a cast
[Code] .....
Now what I'm trying to do is make the ai go through 4 searches in steps instead of looking for any button. I want it first to look for buttons 1, 2 and 3, if there's a space in any then it will be clicked but if all of them are already clicked it will look for spaces in buttons 4, 5 and 6 and so on if that makes sense. But i'm not too sure how I would do it.
View 3 Replies
ADVERTISEMENT
Mar 5, 2013
How do I make a specific character show up a specific amount of times?
Like I am generating a random number then I need to make "|" show up that many times on the screen.
View 1 Replies
View Related
Jul 31, 2014
I want write my first application using Xamarin Studio and GTK#.
I create new file Dialog.cs: public partial class Dialog : Gtk.Dialog
I add Fixed container and can't add buttons, why?
I must use class Window : Gtk.Window instead of Dialog and show modal this window?
View 2 Replies
View Related
Jun 24, 2014
The opjective was to build an c# deskop windows application for an classic car sales company.
My job was the employees section of the application.
my problem is the following
i have 3 tabs
summary (overzicht)
details
mutation (muteren)
on the details tab i have 2 buttons and a search box both the buttons only do somthing on the summary tab where they also need to take the selected row to the field on the other tabs.
the search box is a text box that neds to find the valve in the summary tab and then als so select the full row and put it in the onther 2 tabs fields.
this is the code for the back en next buttons
private void btnback_Click(object sender, EventArgs e)
{
if (dataGridView1.CurrentRow.Index >= 1)
{
[Code]....
View 14 Replies
View Related
Jun 14, 2014
There is a genereted matrix of buttons:
private void Single_Load(object sender, EventArgs e) {
//code here
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
//a lot of working code here
b[i, j].Click += new System.EventHandler(ClickButton);
}
}
}
What can I do when one of those buttons is pressed (i have the method ClickButton) to know what i and j has he?
I want to make something like this
ClickButton() {
if (x%2==0)
v[i, j] = x; //i and j should be form the matrix of buttons
}
View 9 Replies
View Related
Oct 7, 2014
I am developing a small game using MFC in which the game options like new game, save, open, exit etc. can be selected from the menu as well as from the buttons inside the window. I have no problems with the menu but the buttons do not seem to work at all.
The buttons are created at runtime using CButton class. To associate the buttons with the corresponding functions, I just used the same resource ID for the buttons as the menu options, but that did not work. When I click on the buttons, nothing happens. If I assign different resource IDs to the buttons, how do I handle the message map entries? Do I have to write different message map entries for the menus and the buttons while their function is exactly the same?
View 6 Replies
View Related
Apr 13, 2014
I am pretty new to windows programming, but i get around with small applications.
Now I want to create a window with 10 push buttons, and was just wondering if there is some smart way, maybe in a loop to create multiple buttons.
Also, on a very populated window, is there a way to maybe have the WM_CREATE commands stowed away in another cpp file? Just for readabilty.
View 13 Replies
View Related
May 27, 2012
I have a txt file of drinks, and I want to meak a list of buttons of it (the txt file is build like this: fanta : 2 ), how can I make buttons of all the drinks ( I get the first one in a button , but not the others).
Dictionary<string, double> drank = new Dictionary<string, double>();
string[] words = new string[8];
Button button;
<Button> BtnList = new List<Button>();
[Code] ....
View 1 Replies
View Related
Oct 13, 2012
I want to make something like this for a game:
It is a "list box" that has 2 scroll buttons (scroll bar not needed). One button push, "scrolls" the list one entry.
Needs to run crossplatform (windows, linux).
View 4 Replies
View Related
Oct 13, 2012
I want to make something like this for a game:
Attachment 30507
It is a "list box" that has 2 scroll buttons (scroll bar not needed). One button push, "scrolls" the list one entry.
Needs to run crossplatform (windows, linux).
View 2 Replies
View Related
May 23, 2012
how can I create a GUI application that can resize also the control buttons. If the user decide to make the windows bigger or smaller I would like my textbox, buttons, etc.. to follow. Like in Java they use a layout manager, but I can't seem to find the answer for c#. I though to use table layout panel, but it doesn't expand when expanding the windows, unless i miss something
View 3 Replies
View Related
Mar 26, 2013
Is there an easy way to create a column of buttons ina listView?
I need that every file of the listView has a button in the first cell. Is that possible?
View 2 Replies
View Related
Jan 15, 2014
How to increase font size for a specific button? I tried to change the nHeight but it doesn't seems to change the font size.
Code:
CFont font;
font.CreateFont(
12, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_REGULAR, // nWeight
[Code] ....
View 3 Replies
View Related
Oct 17, 2013
I have multiple bitmap buttons of non-square shape. Because of their odd shape I can overlap them and they will still look good on screen, which is what I want - that certain layout.
The problem is that because underlying button in reality is square (which I am subclassing), the bitmap of one button may overlay with the non-bitmap area of the other button (in the underlying square). This means that 2nd bitmap button will not receive notification because the press is registered with top level window only.
Is there a way that both windows can receive the notification and check if they are in the hot spot, they will respond? I know this is against windows design.
View 10 Replies
View Related
Oct 15, 2012
I have successfully compiled a code where I created an array of buttons. I have added a click event to it like this :
Code:
buttons[indexofhashis2]->Click += gcnew System::EventHandler(this, &Execute::GOBUT_Click);
I have a standard event like this
Code:
private: System::Void GOBUT_Click(System::Object^ sender, System::EventArgs^ e) {
int x;
x = sender->Location.X;
}
Returns error saying Location is not a member of Object^.
I'm trying to create an array of button (user/runtime created buttons) and get different interpretations of the click event depending of wich button is clicked.
For example, if we create buttons[0] I wish to get the 0 or something relevant into the GOBUT_Click event.
View 4 Replies
View Related
Dec 31, 2013
I'm trying to find a way to remove an item that has been dynamically added when I change my drop down list selected user. The way this works is I add an edit and delete button dynamically when I select a user. I need to have the existing one be removed when I change users. Here is the code I'm using to build the two buttons. How do I remove them? Do I wipe out the columns and then add the columns again?
try {
dgvBG.DataSource = this.bgDataTableAdapter.GetData(cbPatientID.SelectedItem.ToString());
try {
Image editBGImg = Properties.Resources.editor;
Image delBGImg = Properties.Resources.del;
DataGridViewImageColumn btnBGEdit = new DataGridViewImageColumn();
[Code] ....
View 4 Replies
View Related
Aug 8, 2013
//#import "c:windowsSysWow64mscomctl.ocx" raw_interfaces_only //in window7
using namespace MSComctlLib;
CComPtr<IButtons> pButtons;
CComPtr<IButton> pButton;
CComPtr<IImages> pImages;
[Code] ....
View 11 Replies
View Related
Jun 12, 2014
I'm pretty much newbie in creating a successful GUI in C++. Although, i managed to create 4 buttons that should show a certain form. Lets say, Form1 is my main form, therefore - Button 1 will open Form2, and Button 2 will open Form3..... But the conditions is - If there is a form that is already open, clicking again on the Button that should open it, will Close it, but all the forms (form1,2,3,4,5) can be enabled together.
Also, a very important note is that whenever i close a form, in any way of closing it (Not the main form) It will "save" the changes i made (Such as ticking checkboxes and so..) and won't reopen it, it will just use "Visible" i guess ?
Notes :
If i use Form2 ^form2show = gcnew Form2;
and then Form2->Show();
I will be able to simply ATTACK the button and open Billions of form2 ^_^
Although, when i use Form2->ShowDialog();
It won't let me open the form3,4,5.
Which isn't so bad, but when i exit from the form2, it won't save my changes (Such as checkboxes..)
View 6 Replies
View Related
Mar 26, 2012
I have a calculator with buttons, and when I click the numbers or operators, it goes to a string array. So;
Press 3
Press +
Press 2
Press =
and my array is str[0]='3' str[1]=.... so on...
And also I have a C code which calculates the string you entered with some algorhytms and gives a double value as a result. So the question is;
How can I send my STR array in C# to my C program? I mean I want to use my C program as a source code. and How to return that double value to my C# program?
For now, I don't want to change my C codes into C# codes. I want it to keep as is. Just use it as a source code. Is that possible?
View 2 Replies
View Related
Oct 10, 2013
so I wrote this code in class today and I'm almost done but I need to come up with some sort of equation to add up all the total values. The problem is I am reading data off a txt file so it's all being read as one thing. I don't know how to get each specific value and add them all together. This is my code so far.
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
[Code] .....
here's what's inside the input file
Chisel 50 9.99
Hammer 30 15.99
Nails 2000 0.99
Bolts 200 2.99
Nuts 300 1.99
Soap 55 1.89
I end up multiplying the amount by the price to get the total value as shown in the code above. Now I just don't know how to add the total value of each item to get the total overall value. Also I haven't used invTotal because I want that to be the overall total.
View 1 Replies
View Related
Jun 8, 2014
How do I return a specific value from a function in order for me to cout it in my int main?
In this case i have solved for a value sigma1 in my function but i want to use the value of sigma1 in my int main also and in other places so how would i do that?
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
[Code].....
View 5 Replies
View Related
Dec 13, 2014
I created a program that will create a file and print a list on it. Here is the code for my program:
Code:
int controlvalue(void) {FILE *controlvalue;
controlvalue = fopen("something.txt", "a+");
/* Series of fprintfs */
fclose (controlvalue);
return 1;}
Here is an example list created by my program:
Code:
[Gifts]Candy=45
Chocolate=32
Toy=128
Robot=754
Doll=1492
Star=21
Phone=72
Skateboard=87
Frame=314
Days=365
Perfume=421
I want to get the value of "Skateboard" on file. So I need to read 9 lines. On the 9th line, the gets() loop will stop. But, what if I only want to get the value of "Skateboard" as integer (87) and not a string? Also, is it possible to scan the value of Skateboard if it's located on a different (or unknown) line?
View 1 Replies
View Related
Jan 12, 2015
I want to access specific lines in a "*.txt" file. I've heard of seekp() and what not, but don't know how to call them as such.
View 6 Replies
View Related
Mar 16, 2015
im having trouble with a function im writing. Its supposed to find the minimum value in an array and return the location of that value heres what i have so far :
int findLowest (int numb []) {
// findLow will hold the subscript of the lowest value in the array
int findLow = numb[0];
int x;
for (x = 0; x < 5; x++){
if (numb[x] < findLow)
findLow = x;
}
return findLow;
}
View 3 Replies
View Related
Apr 26, 2015
I want to replace what is in a specific sector with value inside a buffer(dummy value). This code will read what is inside a specific sector. To make sure it works it display what is inside the sector and it displays the chosen dummy value. (the two cout's in main)
What I want to do is to replace the dummy value with what is inside the specific sector. So if the dummy value is '0', I want to replace what is in sector 285 with '0'.
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
using namespace std;
#define FILE_SHARE_VALID_FLAGS 0x00000007
#define BUFFER_SIZE 512
[Code] ....
View 1 Replies
View Related
Oct 10, 2014
I'm trying to open a text file with the name "text.txt", for the purpose of only displaying in the console an specific part of the text file. For example, if I got "This is a test [TEXT] This is the message that should display [/TEXT] this is the end of the file", I want only "This is the message that should display" to be the output, the thing is that I can't imagine anyway of doing that. what I should do?
View 5 Replies
View Related