Jump to content
Xtreme .Net Talk

bpayne111

Avatar/Signature
  • Posts

    335
  • Joined

  • Last visited

Everything posted by bpayne111

  1. you should look into serielization i think make a card class and a card collection class that inherits from collection base make both classes serializable and wala objects made easy and then you can access your card collection as you would an array i hope that helps brandon
  2. did you try it with no notifactions on your machine? brandon
  3. check the helps for FileSystemWatcher class in the System.IO namespace hope it helps brandon
  4. what's a 'braindump'?
  5. thanks i guess i did answer my own question in a way. and yes i really want this to change colors cuz the best art i've created is the logo next to my name in this forum (sad eh?) so taking a cool font and changing the color of it's text at random will kind of make me feel better about not being artistic. well i am artistic but i have to play CHESS to show it ;) thanks for even considering reading all the crap i posted here i should have realized the answer myself MERRY CHRISTMAS brandon
  6. why not refresh form 1 and then refresh form 2 as well to switch the focus back to form 2? just a thought brandon
  7. create a 'blank' icon and set the icon to the childs icon then it will appear invisible brandon
  8. why would using tick to make calculations be different than having tick call a method? i know little about delegates because i'm a c# rookie :( actually i just realized i wrote this one in vb but i can convert it to c# very quickly if i need delegates i am posting the code of this class so that it is obvious what this thing does. the code is rather 'rough' because well i'm lazy i guess. Public Class BPLogo Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() Me.SetStyle(ControlStyles.UserPaint, True) Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) Me.SetStyle(ControlStyles.DoubleBuffer, True) currentRGB = randomRGB.Next(0, 3) 'Add any initialization after the InitializeComponent() call End Sub 'UserControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Timer1 As System.Windows.Forms.Timer <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Me.Timer1 = New System.Windows.Forms.Timer(Me.components) ' 'Timer1 ' Me.Timer1.Enabled = True Me.Timer1.Interval = 50 ' 'BPLogo ' Me.Name = "BPLogo" Me.Size = New System.Drawing.Size(48, 48) End Sub #End Region #Region "Declarations" 'this control will be the Letters BP in the corner of the screen, they will change ' colors at a givin rate, adjust to different sizes 'in the future i plan to use this buttton as my exit/minimize button on a custom form Private mColor As Color = Color.AliceBlue Private mSize As Short = 20 Dim myFont As New Font("Sylfaen", mSize, FontStyle.Bold) Dim myBrush As New SolidBrush(mColor) Dim randomRGB As New Random(3) Dim randomIncrementTo As New Random(111) Dim increment As Short = 1 Dim value As Short Dim rgb As Short() = {0, 0, 0} Dim currentRGB As Byte Dim valueReached As Boolean = True #End Region #Region "Properties" Public Property LogoSize() As Short Get Return mSize End Get Set(ByVal Value As Short) mSize = Value myFont = New Font("Sylfaen", mSize, FontStyle.Bold) Dim mycolr As Color End Set End Property Public Property StartColor() As Color Get Return mColor End Get Set(ByVal Value As Color) mColor = Value End Set End Property #End Region #Region "Methods" Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs) Me.Height = Me.Width mSize = (Me.Width / 2) myFont = New Font("Sylfaen", mSize, FontStyle.Bold) Me.Refresh() End Sub #End Region #Region "Events" Private Sub BPLogo_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint e.Graphics.DrawString("BP", myFont, myBrush, 0, 0) End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick myBrush.Color = Drawing.Color.FromArgb(rgb(0), rgb(1), rgb(2)) Me.Refresh() If valueReached Then currentRGB = randomRGB.Next(0, 3) Do While valueReached = True value = randomIncrementTo.Next(0, 255) If rgb(currentRGB) < value Then increment = 1 valueReached = False ElseIf rgb(currentRGB) > value Then increment = -1 valueReached = False Else valueReached = True End If Loop End If rgb(currentRGB) += increment If rgb(currentRGB) = value Then valueReached = True End Sub #End Region End Class so this paints 2 letters and changes the letters colors randomly constantly. This control will be added to any program i create as my personal trademark. One of the first applications i'm going to add it to is a Client/Server app. i never plan on editing anything about this control during runtime. it's basically completly self contained. my concern is. If i'm loading a database or something of that nature. and my control is visible. Will it continue to change colors using a timer or will it stop untill the db loads? that is what makes me think i should use a thread instead of a timer to change the colors. to sum it all up. I want this control to change colors no matter what is happening in any app that is using it and i'm worried the timer won't accomplish that. thanks for your help guys i hope i can figure this one out before it destroys some app of mine while i'm debugging. merry christmas sorry i made this so long brandon
  9. yes it's very simple just use the same code i posted above only 'vb style' <Category("Appearance"),Description("The text to display")>Public Property Anything as String i'm pretty sure that will work it worked for my control that i created in vb. OHHH WAIT do you mean while you are coding or in the form designer? that code will add it to the form designer. VB DOES NOT allow you to add descriptions of your own classes to the intellisense. it looks like C# does have it's advantages C# uses an xml tag to do this before the declaration. but i do remember reading in my oop book that vb won't let you do it. with my experience so far C# is more confusing than vb but it seems to be more flexible to me. sorry about your property descriptions... maybe you should make the switch like me. after all it seems to me more employeers like C better than vb anyway so i figured it'll look better on a resume. especially if i get a job and they aren't in .NET yet... it'll be easy for me to learn C++ then if i have to (like i want to!!!!!) thanks later brandon ps other properties of my control did get added to the designer but the text property would not work... i simply changed the name of it to DisplayText and it worked fine.... i'd rather use just Text but ohh well it's still in the Appearance category so people will figure it out.
  10. too add to the prior statement... i used new in my declaration because the text property is alraedy included in the userControl class but not displayed in the form designer. That prompted me to shadow the property and add a category and description? i'm suprised no one has responded to this it seems like a rather easy issue. after all i did this all the time in vb but not in c# things don't seem to be the same. heeeeeeeeeeeeeeeeeeeeelp thanks brandon
  11. i appreciate yoru comment but it seems you sort of halfway answered my question my original question " Would using a timer to fade the text create issues in a multithreadd environment?" In order to better specify what is happened i'll explain my project more in depth. I have created a control which is simply my initials painted on the control that fade to random colors constantly. I'm using this control as my own personal 'tag' for my programs. It works wonderful as of now but my concern is.... if i throw this control on say the client of a server app, will it not work correctly using a timer. Your response makes me ask another question though... you say threads aren't 'safe' but wouldn't using a lock block in my class when the class decides to update be ok? in reality no other control will ever 'change' my control because it's just a bit of text that changes color. so even locking it wouldn't seem to have an effect on any other threads to me. i'd also like to check and see if i interpreted your post right in other words you say ms says that delegating basically means 'don't use threads' that's how it sounds to me. i think i'm going to create my project both ways and see how thigns work out. i'd stil llike to hear your input on things again though. thanks brandon
  12. #region Properties [Category("Appearance"),Description("The text to display")] override public string Text { get{return _text;} set{ _text= value;} } #endregion i have declared a property like so in a user control. My goal is to make the text property appear in the form designer. I've had this work before in vb but it's not showing up like i'm used to in c#. Is there a step involved i'm missing? thanks brandon
  13. i have a user control which displays some text and fades the colors randomly. Would using a timer to fade the text create issues in a multithreadd environment? If so would using Thread.Sleep be a better option to make this work correctly in any application of mine? thanks brandon
  14. yes derek i think you are right. I took the concept provided and added my oop knowledge to it to create a Server component and now it all made sense. Thanks brandon
  15. i'm following the example in a book and i have these variables defined public class User { internal Socket _connection; //why is this internal private Thread _readThread; private NetworkStream _socketStream; private BinaryWriter _writer; private BinaryReader _reader; } my question is why is _connection internal instead of private? i do not notice any other parts of my application using _connection so it would seem private is ok. Does the threading have something to do with this? thanks brandon
  16. I'm creating a user control to represent my 'logo' i'm using the Graphics.DrawString method to draw some text on the logo. I have a System.Drawing.Brush declared to contain the color of the string to draw. I'd like this Brush object to cycle through the different colors sequentially back and forth. Can someone post a block of code that would demonstrate this technique. I have provided a method here with an example private Brush _brush = Color.Blue; private void ChangeColr() { _brush = what? //make the brush's color just slightly different } thanks brandon
  17. I am trying to create a basic game server. I am creating a GameServer class to represent the Server app and the GameClient class for the client. I am allowing for multiple users and multiple games at the same time. To debug this app my computer must run as a server and 2 clients at the same time. Is this possible to do on one machine? Or should i wait until i get my laptop for christmas? I've tried doing a Tic-Tac-Toe example that i found in a book of mine. When attempting to debug it loaded the first client' app correctly but not the second client's. I'm going to check over my code again to see if i missed something. I noticed another post in which a person was having difficulty hosting games from a pc using a router. My pc is using a wireless router to establish it's connection. How will this effect the development of my app? Sorry for so many questions in one post but i'm kind of brainstorming here. thanks brandon
  18. make a user control that represents the colors you want to display. use some labels to show the colors and make a single method that handles all the click events of the labels. brandon
  19. IIS must be installed before you install VS.net. if not it will not work correctly hope that helps brandon
  20. yes i thought it was right but i felt it was wrong for a moment so i commented out the Clone method and recompiled my class and no errors were found. If the clone method hasn't been created shouldn't my class declaration show an error? I can do this in vb with myeyes shut but in c# i'm new so things like this bother me. I'll mess with it some more to see if all is well but something seemed fishy to me. thanks brandon
  21. yes i've been over that idea before... basically it = the same two problems that i ahve alraedy.. hmmm well you know a new thought just occured (amazing considering i've been drinking) If i am allowed to assume that the created and changed events are called twice everytime for a file then i could do that. Well after mental analysis that creates a new problem. (assuming antivirus causes these events) I can not assume everyone has an antivirus that would fire these events twice. So this is leading me in a new direction that might help though... If all antivirus programs cause these events to fire like they do. I could check to see if antivirus software is enabled when the program starts. The more i think about this th emore problems it creates than solutions because more and more things could go wrong with this (let's say for some odd reason they disable the antivirus or something) So this leads me to my newest idea to solve this. If and only if all antivirus programs cause these events to fire again (and it only happens once no matter how many antivirus programs are running) Then i could try somehow to see if antivirus is enabled on that computer and THEN i could easily cancel out the extra event with a counter. This would force me to check for the change of status of antivirus software all the time with another thread which i'm not happy with but able to accept. So where do i go with that idea? i almsot thin ki should start another post for that. but i'd like to see this one get over 100 reads. It looks like we are breaking new ground thanks for your input once again. I hope this post of mine makes sense cuz i did have like 6 beers so i'm likely to have made some typos so bare with me. thanks again brandon
  22. did i declare this inheritance and implementatoin correctly? [serializable()]public abstract class PieceCollectionBase:System.Collections.CollectionBase,System.ICloneable thanks brandon
  23. ok the created event is called, but sometimes is not ready to be read. Then another created event is called for the same file. The changed event is called, and the file is ready for access. The changed event is called again for the same file. .pgn files are chess game files. They can hold as many chess games as a file can be large. As of now i'm not writing to a db because i know just enough to piss me off about them. So i'm writing them to another text file instead. My text file i created in my program will contain all games from all files. Which will eventually actually be a db which gathers statistics about these games. I think file.Length will be enough to satisfy my users. it is very rare a person would go into a pgn file and edit it. the only reason would be if they are playing the game blind (without a board) or if a certain website they play at has some bugs in the way they notate a chess game in the pgn file. Both of these occurances are fairly rare, but they can happen so therefore as a programmer i feel obligated to do something to fix that. so one day i may think of a solution but who knows i'm curious of the CheckSum of a file. I know antivirus software uses this to determine if the file has been edited or something. know anything about CheckSum? i may start anoher post with that question
  24. i have a clas which inherits from CollectionBase. I've made it Serializable. and clone it by using serialization I've noticed the ISerializable interface lurking around in .NET my question is what is this implentation for? When should i use this implentation and would my collection base be a good time for this implementation? thanks brandon
  25. problem not solved.. because if the same file is edited twice in a row it will be ignored... nice try though thanks brandon
×
×
  • Create New...