|
sorry for the typing mistake,... i neead modal, but it's creating modeless... .
kamalesh
|
|
|
|
|
OK, perhaps you're right, you're on another thread, and that is the problem.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, In my game that I'm making I have a 2D Array of Picture boxes. Using a function:
<br />
<br />
image_arr[0] = Bulldozer_2._0.Properties.Resources.empty;
image_arr[1] = Bulldozer_2._0.Properties.Resources.wall;<br />
image_arr[2] = Bulldozer_2._0.Properties.Resources.target;<br />
image_arr[3] = Bulldozer_2._0.Properties.Resources.rock;<br />
image_arr[4] = Bulldozer_2._0.Properties.Resources.target_w_rock;<br />
image_arr[5] = Bulldozer_2._0.Properties.Resources.bulldozer_down;<br />
image_arr[6] = Bulldozer_2._0.Properties.Resources.bulldozer_up;<br />
image_arr[7] = Bulldozer_2._0.Properties.Resources.bulldozer_left;<br />
image_arr[8] = Bulldozer_2._0.Properties.Resources.bulldozer_right;<br />
<br />
const Byte IMAGE_WIDTH = 32;<br />
const Byte IMAGE_HEIGHT = 32;<br />
<br />
PictureBox[,] PicBoxes = new PictureBox[MAX_ROWS, MAX_COLS];<br />
<br />
private void draw_image(Byte type, int row, int col)<br />
{<br />
PicBoxes[row, col] = new PictureBox();<br />
PicBoxes[row, col].Name = "pictureBox1";<br />
PicBoxes[row, col].Size = new System.Drawing.Size(IMAGE_WIDTH, IMAGE_HEIGHT);<br />
PicBoxes[row, col].Image = image_arr[type];<br />
PicBoxes[row, col].Location = new System.Drawing.Point(col * IMAGE_WIDTH, row * IMAGE_HEIGHT);<br />
}<br />
<br />
Got any ideas why the image isn't showing up? The Images are there and in the resources folder.
|
|
|
|
|
in draw_image add it to form controls
Form.Controls.Add()
|
|
|
|
|
I typed Form but there was no "Controls" sub program.
|
|
|
|
|
Form is the name of the class. You need the name of the form itself, which you did not provide. Actually, you need to replace Form with this, as you're inside the form.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I partly understood what you meant so I put "PicBoxes[row, col].Controls.Add();" but I don't know what to put for Parameters.
|
|
|
|
|
Controls is not a program but member collection.
As I have written before - formName.Collection.Add()
Collection is without ()
|
|
|
|
|
I'm not too familiar with object oriented programming. I'm used to C++ and PHP. I kinda figured out through trial and error but what do I put for the parameter for Add ()?
|
|
|
|
|
your function should looks like this:
private void draw_image(Byte type, int row, int col)
{
PicBoxes[row, col] = new PictureBox();
PicBoxes[row, col].Name = "pictureBox1";
PicBoxes[row, col].Size = new System.Drawing.Size(IMAGE_WIDTH, IMAGE_HEIGHT);
PicBoxes[row, col].Image = image_arr[type];
PicBoxes[row, col].Location = new System.Drawing.Point(col * IMAGE_WIDTH, row * IMAGE_HEIGHT);
this.Controls.Add( PicBoxes[ row, col ] );
}
the bold line is missing in your code.
|
|
|
|
|
It compiles okay but when I run it I get this error:
An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
Additional information: A circular control reference has been made. A control cannot be owned by or parented to itself.
|
|
|
|
|
You cannot call data.Controls.Add(data), where "data" is any object.
Jeff
|
|
|
|
|
Then what would I put there? The Form? That would make sense I'll try that.
[Edit Nope that didn't work]
|
|
|
|
|
What command are you currently using?
|
|
|
|
|
this.Controls.Add( (PictureBox)PicBoxes[ row, col ] );
if your table is not of type PictureBox.
read documentation to classes which you use. write PictureBox class in google and you will have everything you need
|
|
|
|
|
Sick. Thanks a bunch Ermak!!
|
|
|
|
|
Jordanwb wrote: I'm not too familiar with object oriented programming. I'm used to C++
That's just mind blowing. That also has nothing to do with this, the form has a Controls property, which has an Add method, and if you open your brackets, intellisense will tell you what to put in there.
Jordanwb wrote: I kinda figured out through trial and error
you'd do better to buy a book and work through it
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
is there any way to host a java applet in windows forms without using a WebBrowser control? i'd like this to be as lightweight as possible (ironic as that sounds). i searched the web and couldn't even find an example in native code.
|
|
|
|
|
zildjohn01 wrote: i searched the web and couldn't even find an example in native code.
There may not be any examples. However since all the browser authors did it, it must be possible right? All you have to do is recreate whatever work they all did and presto, you're done.
|
|
|
|
|
led mike wrote: recreate whatever work they all did
why didn't i think of that? this'll be simple! *downloads firefox source code* (sarcasm)
that code doesn't tell me a thing, i don't even know where to start. if i think about it though, didn't sun (and microsoft, and other vm devs) write the browser plugins themselves? meaning instead of just hosting the applet, i'd have to simulate a browser environment...
this might be more work than it's worth...
|
|
|
|
|
zildjohn01 wrote: this might be more work than it's worth...
Duh
|
|
|
|
|
ok that was mean... lol. WebBrowser it is. i guess i'll just SetParent the java window or rewrite the html and strip the ads out
|
|
|
|
|
zildjohn01 wrote: i guess i'll just SetParent the java window or rewrite the html and strip the ads out
Keep in mind you never actually stated the problem you are trying to solve. Rather you asked how to accomplish a specific solution.
|
|
|
|
|
Is the MCISendString function in winmm.dll suitable for playing the music in a game? I would use wave files with the PlaySound command but file sizes are too large!
Thanks
|
|
|
|
|
I am attempting to make a set of textboxes that will allow dragdrop operations. I am inheriting from RichTextBox in my class and have added the following code...
...
// Only allow copy if this textbox is readonly (cannot move from this box)
if (base.ReadOnly)
this.DoDragDrop(this.SelectedText, DragDropEffects.Copy);
...
protected override void OnDragOver(DragEventArgs drgevent) {
// Set the effect, based on keys pressed and drgevent.AllowedEffects
}
The problem is that drgevent.AllowedEffects is ALWAYS (Move|Copy|Scroll). Then, when I set drgevent.Effect to DragDropEffects.Move (since I have no way to see if the source is readonly), I get the cursor indicating that NO dragdrop operation is allowed. Is there any way for me to get the value passed into DoDragDrop, or at least see if Move is allowed by the operation so I can set drgevent.Effect to Copy? Thanks,
Jeff
|
|
|
|