|
Well, that was it! Thank you for the suggestion. I made a clone, made it invisible and used it in the swap, like this:
f (posn1 z<> posn2) Then
KingH(0).Picture = Image1
posn1).Picture
Image1(posn1).Picture = Image1(posn2).Picture
Image1(posn2).Picture = KingH(0).Picture
|
|
|
|
|
yeah ! cool !
whahoo ! we solved it !
Jarno Burger
Video Jockey
|
|
|
|
|
Yep we did; thanks!
I have another question. Trying to move the image1(12) card (drag and drop) to the hearts(12) card. Testing to see if the tags are equal first, which they are set in design view, then setting the same image bitmap of image1(12) card over (dropped on) the blank image of hearts(12) card. What happens at run time is ALL the cards 0 - 12 of image1 can only be dropped in hearts(12) spot. None of the other cards in the image1 stack (up to 52, remember, I'm just doing a sample first) can be dropped over the hearts cards, but no "shirley" error message pops up either. Any suggestions?
Pardon the format; just testing now
'Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
'Image1(Index).Picture = Source.Picture
'End Sub
Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
'Dim ImageIndex As Integer
Dim HeartsPic0 As Image
HeartsPic0.Picture = Source.Picture
Source.Picture = LoadPicture("C:\Program1\013h.gif")
If Image1(12).Tag = Hearts(12).Tag Then
Hearts(12).Picture = HeartsPic0.Picture
Else
MsgBox ("You're wrong Shirley")
Exit Sub
End If
End Sub
|
|
|
|
|
.tag is normally object. comparing object with object sometimes work. but to be sure , do a ctype(image(x).tag , string/integer/double/your class type ) first. Your watch window in visual studio does some neat tricks to show you what is in the tags. But the bad thing is , that your code doesn't know, only that watch-window does (thats called reflection).
You have to "convert the object back to your type of class"->ctype(thingie , class-type) . Just to make sure your tag is ok.
And maybe Debug.WriteLine all the tag info constantly to your debugger window. Maybe something goes wrong somewhere else , working with tags , (that could behave like any object) , can be tedious.
In your case , are your tags your game-data , or are there other array's of stuff with game-data ? Try to make a mental split-up of game-data and interface. Build a 'huge' game-data class .
You'll add / remove / update /load / save / (de)serialize your gamedata. In that way , maybe in the future you only have to type in the intermediatewindow or debugwatcher :'gamedata.show' , to show all the gamedata in one list in the debugwindow or debugwatcher.
Later in the future you can remember multiple "states" of gamedata , to have a undo/replay function.
Jarno Burger
Video Jockey
|
|
|
|
|
Hi.
I have a textbox that is constantly updated line by line from a process.startinfo... thingy. The text pasted in the textbox is actully console application output.
What i need is a string variable that always holds the last line from the textbox when its updating (new lines are added).
Does anyone know how i can do that?
http://www.themightyatom.nl
|
|
|
|
|
Hi,
assuming your other process is outputting lines of text (lines separated by NewLine) then it isn't very wise to (1) concatenate all of them since that is what a TextBox needs, and (2) then try to find the last line again.
For starters, remember the most recent line where it comes in (maybe in a Process.OutputDataReceived handler?) i.e. before it gets concatenated; and then maybe drop the Textbox, i.e. if you are not relying on the wrapping capabilities of a textbox, then use a ListBox instead. It is both easier and faster.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Well, the process that im running is a compilation process with its output redirected to a textbox, and i'd like to use regular expressions later to colorize error and warning messages.
I already have a sub that is fired when a new line is added to the textbox, i just need a string variable to hold the last pasted line. I need to compare something. Its hard to explain, unless you know what level design for the game Half-Life is all about...
Ill experiment with a listbox.
http://www.themightyatom.nl
|
|
|
|
|
Hi,
if your ListBox output needs some formatting, then you have to paint the content yourself: switch its DrawMode to one of the "OwnerDrawn" values and provide a DrawItem handler, wich can be as simple as
public void lb_DrawItem(object sender, DrawItemEventArgs e) {
ListBox lb=sender as ListBox;
int index=e.Index;
if (index<0 || index>=lb.Items.Count) return;
string s=(string)lb.Items[index];
e.DrawBackground();
g.DrawString(s, font, brush, e.Bounds);
}
assuming each line uses a single format (you need to provide some font and brush; if you create them inside the DrawItem handler, don't forget to dispose them too).
BTW: one nice characteristic of the ListBox is it only calls DrawItem for the lines that are actually visible, so when thousands of lines are present, but only 25 or so are visible at any given time, only those 25 will fire the DrawItem colorization and painting.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
what did for my debugger , put every given string in a array with a fixed length.
when there was a new string , i fisrt moved every string one position in the array , meaning that the first one would be dumped.
FIFO.
a array with strings was a lot easier to edit/view.
you could also use a queue , but i love to build stuff myself , loving hobby code
Jarno Burger
Video Jockey
|
|
|
|
|
Hmmm... this is tough.
I tried a listbox to display the output, and it works fine, even better than a textbox.
But what really annoys me is that a listbox does not allow you to colorize specific items (fore and backcolor). It also flickers like crazy. So was thinking, are there custom listbox controls out there with the exact same functionalities is the stock listbox, only with the added ability to colorize the backcolor and/or forecolor of specific listbox items?
I google like crazy today but found squat.
http://www.themightyatom.nl
modified on Thursday, May 28, 2009 12:51 PM
|
|
|
|
|
I don't think there are such list boxes. I would stay with the textbox or use Scintilla.NET http://www.codeplex.com/ScintillaNET[^] it has syntax colloring built in.
To get the last line, search backwards to the first cr/lf and you got your line.
Good luck: Didi
|
|
|
|
|
Yeah i think so, i already found a custom listbox control that supports item colors, but it flickers like crazy when items are added in a short timespan.
Ill try that ScintillaNET thingy. If i understand correctly, this is a pack with new/updated controls with new features?
http://www.themightyatom.nl
|
|
|
|
|
You could use BeginUpdate and EndUpdate on your control before and after the adding of items (that works on most controls). Yes Scintilla.NET is a pack with controls in it...
Regards: Didi
|
|
|
|
|
I tried the beginupdate and endupdate, but i want the user to actually see the process.
As for Scintilla.NET, it only adds four unkown controls to the toolbox. I don't know how i could use that with my textbox. Plus, it makes my Visual Studio crash. :/
http://www.themightyatom.nl
|
|
|
|
|
you don't use it with your textbox, but instead of. Find documentation on Scintilla Documentation[^] Scintilla.Net is a wraper of Scintilla, a c++ rich text control with sintax highliting etc.
What exactly do you do, just before your VS crashes?
|
|
|
|
|
Nevermind, im not going to use it, too complicated for me.
Ill just stick to a richtextbox.
If i just could find a way to get the last line of that constantly updating textbox, i may just get it to work.
Syntax highlighting using regex isn't the problem, i know how to do it.
http://www.themightyatom.nl
|
|
|
|
|
To get the last line, search backwards to the first cr/lf and you got your line. Find info here[^]
Good luck: Didi
|
|
|
|
|
Hi,
This is Alokesh,I am unable to insert any kind of image in menubar control in VB.net. Please tell how can I do it? Your quick response will be earnestly solicited.
With Thanks and regards,
Alokesh
DBS, Chennai
|
|
|
|
|
Hi, This is E.T.
Use the image property and select the file you want to use in the import box. Make sure the image you are trying to use is a supported format (which are listed int he Files of type combo).
Cheers!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
But there is no image property for menubar control
|
|
|
|
|
The MenuBar itself can't have an image, unless you take over all drawing of the control and supply th ability to have an image. Warning! That is NOT a simple topic.
|
|
|
|
|
try googling for a menu control, that can do, what you want...
Good luck: Didi
|
|
|
|
|
And why are you telling me this?? Reply to the orignal poster. That way, he gets an email that you replied to HIS message. Replying to some elses message only sends the notification email to the one person you replied to, not the OP.
|
|
|
|
|
Sorry, I didn't realized that.
|
|
|
|
|
Hi,
Should i take care of both the variables which are consuming the memory on heap/stack, while releasing the memory in finally? Or just heap variables are enough to be released?
dim d as integer=0
Dim f As DataGridView=nothing
try
d = 10
f=new datagridview
catch(byval ex as exception)
finally
d=nothing
f=nothig
end try
|
|
|
|