
Cags
Avatar/Signature-
Posts
699 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Cags
-
I've always used Application.Exit() as a way of closing down my application. It recently dawned on me however that doing so doesn't appear to call either Dispose, OnClosed or OnClosing (at least a break point doesn't stop in them) of the form which is passed to Application.Run(). Now call me niave, but I always assumed this was the case. Whilst I never realised this untill now I have never appeared to have any ill effects such as memory leaks, now is this through sheer luck or is there another explanation (such as the Disposed method being called, but after the debugger has been detached from the appliction)? I've recently been starting todo some stuff that involves alot of API calls and I'm worried that I may leave things behind in memory that should have been dealt with. Is there one method that I can put disposal code in that is always likely to be called, or is it simply a case of ensuring I dispose of the form before calling Application.Exit()? On a side note, is clicking the stop in Visual Studio whilst debugging the same as calling Application.Exit() or does it exit the application in a different manner? In which case similar to my early question, is there anyway to ensure a section of code is ran before the application exits when the stop button is pressed.
-
Something like the following should work for you, it is however by no means the only way of doing it. I'm a C# user myself, hopefully I translated it to vb correctly. Dim reader As New System.Xml.XmlTextReader("path") While reader.Read() If reader.NodeType = System.Xml.XmlNodeType.Element Then If reader.Name = "EthylOpts" Then cmbPun.SelectedIndex = Single.Parse(reader.GetAttribute("PunishValue")) cmbBan.SelectedIndex = Single.Parse(reader.GetAttribute("BanSetValue")) ElseIf reader.Name = "Options" Then CFNick.Text = reader.GetAttribute("NickName") txtpun.Text = reader.GetAttribute("PunishTime") txtban.Text = reader.GetAttribute("BanSettings") End If End If End While
-
It won't be greatly in-efficient because you won't do it every time you need to draw the image. You only need to do it when your game loads. The altered image can then be stored for use within the game. Using GetPixel and SetPixel would be one way of going about it, I'm not sure it would be the most efficient however. Btw is it a bomberman clone your working on?
-
Whether .Net 2.0 is different I don't know, but in 1.1 at least the following code will not run because "Roxbury22" can't be cast to a boolean. If ListView1.Items(I).Text = "Roxbury" Or "Roxbury22" Then ListView1.Items(I).ForeColor = Color.Red End If The following code works for me... If ListView1.Items(I).Text = "Roxbury" Or ListView1.Items(I).Text ="Roxbury22" Then ListView1.Items(I).ForeColor = Color.Red End If
-
ContainerControl adding items, items cannot be focussed?
Cags replied to Winston's topic in Windows Forms
It might help if you post some code showing how your adding the controls from within the class. I can think of no inherent reason it wouldn't work, so it's perhaps the way your adding them. -
This isn't going to be particularly easy to achieve. If the areas you wish to change on all files were a specific colour, then you could just check for pixels of that colour and then change the colour. It's seems from your example however that this won't be possible. I'm assuming that whilst the bomb is black and you wish to change its colour, the character won't be black to start with. One way of doing it would possibly be to create a mask file. Basically a second image that contains only 2 colours, one colour represents which pixels of the original to keep, the other represents which to alter. I'm no expert at picture manipulation, but thats probably how I'd go about it. Somebody more used to this kind of task may have a better idea.
-
I also originally found my way here from the sister forum for VB. I signed up there back when I was first learning to program. Eventually when I got a placement job for my degree and moved into .Net development, I made the natural progression over to this forum.
-
try... [CS]TextBox1.Multiline = True; TextBox1.Text = "Line 1\r\nLine 2";[/CS]
-
drawing line without invalidating whole screen
Cags replied to msmeth's topic in Graphics and Multimedia
Unless you post (at least some) code, it's going to be very difficult for us to help you with this matter. With drawing there are so many different variables, us guessing exactly whats causing your problem could take forever. -
Casting subclass to its baseclass to retrieve its data members value
Cags replied to a1jit's topic in Visual C# .NET
I must admit I only have experience of .Net 1.1 and VS 2003, but as you say this type of conversion is certainly possible in those and I cannot see any conceptual reasons for them to have taken out such functionality. The only thing I can think of (and I highly doubt its your problem) is that there are two TreeNode objects in .Net, one in the System.Forms.Controls. Namespace, and the other is in the Web namespace as you say. Are you certain the DGTree object is inheriting from the right one? I would imagine if this was wrong you would encounter a problem before this point, but I just thought I'd throw it out there anyway. -
Can you not use the Closing event of the main form to manual close each child form. Obivously this will only work if you can reference the 'child' forms. Assuming you are creating the 'child' forms from the main form in the first place it should be easy enough to create an array of them.
-
It isn't on my pc.
-
I believe the simplest answer to that question is probably no, Visual Studio does not support setting a controls background to transparent. Setting a controls background colour to transparent essential copies the background colour of its parent object rather than actually making its background transparent. In that particular instance I can suggest a really nasty work around. Add a label to the group control with a height of 2, and its border property set to 3d. then position it at the bottom of the group control and it will appear to complete the loop. Somebody else may have a better solution, but you might have to wait awhile for another reply.
-
I'd certainly be interested in hearing more about the project, but more from a conceptual interest than an interest in helping.
-
Marble_eater is an admin isn't he?
-
You can access items from a CAnalysisFieldCollection object using the following code.... (myCollection is a CAnalysisFieldCollection object). foreach(CAnalysisField field in myCollection) { double id = field.id; string fullname = field.fullname; }
-
The line public class CAnalysisFieldCollection : CollectionBase simply creates a class called CAnalysisFieldCollection which inherits from CollectionBase. A1. CAnalysisFieldCollection myCollection = new CAnalysisFieldCollection; A2. return myCollection;
-
The architecture... public struct CAnalysisField { public double id; public string name; public string fullname; public string description; } public class CAnalysisFieldCollection : CollectionBase { public CAnalysisField this[int index] { get { return (CAnalysisField)List[index]; } set { List[index] = value; } } public void Add(CAnalysisField value) { List.Add(value); } } It's use in a loop would be something like... while (reader.Read()) { CAnalysisField tmpItem = new CAnalysisField(); tmpItem.id = reader.GetDouble(0); tmpItem.name = reader.GetString(1); tmpItem.fullname = reader.GetString(2); tmpItem.description = reader.GetString(3); myCollection.Add(tmpItem); }
-
Creating a strongly typed array class could solve your problem. Essentially you could then have an array that works similar to an ArrayList. I'm not 100% sure off the top of my head if it's possible to create a strongly typed array of structs, but if it isn't you could possibly use a small class rather than a struct?
-
The second rule of admins is... you do not talk about admins.
-
Dim path As String = "c:\\image.jpg" Dim fs As New IO.FileStream(path, IO.FileMode.Open) Dim bmp As New Bitmap(fs) fs.Close() PictureBox1.Image = bmp
-
The example I gave does create new instances but the point is with something of this nature you shouldn't have to create the instances yourself. Its a relatively easy task of creating the entire grid from code, I guess we just don't understand why you would want to sit there and manually position 81+ textboxes when it can be dont through code. I've created a doku based game myself (i say doku as it's dynamic allowing for grids of any size not just 9x9 sudoku), and I personally use GDI+ to render the grid to the user. It can take some time perfecting the algorithm to position each square (especially if you intend to leave a bigger gap every 3 etc.). Even so this is by far a better option in my opinion.
-
Well it's very difficult to provide an example of the code without actually knowing what exactly you want the event todo. I can give you an example of attaching an event (in case you don't know how todo this). ' create an event like so Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) ' stuff todo when event fired End Sub ' in your code you attach the event with AddHandler Button1.Click, AddressOf Button1_Click I think it's right, I'm a C# person myself though. Basically what the code does is attaches the sub Button1_Click to the Click event of an object called Button1.
-
Ahh ok, I see what your saying. In that case I'm not sure what you can do. I personally find panels easier to work with that html tables, but I guess it depends what your used to.