Jump to content
Xtreme .Net Talk

aewarnick

Avatar/Signature
  • Posts

    1052
  • Joined

  • Last visited

Everything posted by aewarnick

  1. You aren't overriding OnPaint and using e to paint with. You don't need CreateGraphics.
  2. I'm sure there is a better way of doing this. Maybe by handling the WINDOWPOSCHANGING 0x46 message when overriding WndProc.
  3. No, forget about the string array. Use an ArrayList instead. Or create your own List class. It is easier just to use ArrayList though. /// <summary> /// Returns a string array of all files in a directory. /// </summary> public ArrayList GetAllFiles(string Dir) { string[] E= Directory.GetFileSystemEntries(Dir); for(int j=0; j<E.Length; j++) { if(Directory.Exists(E[j])) GetAllFiles(E[j]); else RecList.Add(E[j]); } return RecList; } RecList is the ArrayList.
  4. Volteface...mutant, do you see anything wrong in that code above? I have in in OnPaint, does it need relocated to work?
  5. Bmp.GetPixel(10,10); It is in my list. Put 10,10 in the parenthesis and see if it compiles.
  6. Look into the Process class. Many posts about it here. Look in Search.
  7. /// <summary> /// Returns just the filename excluding the extention. Option to include extention. /// Put any string in second argument. Could use Path.GetFileName() instead. /// </summary> /// <param name="file"></param> /// <returns></returns> public static string CutOutFilename(string file) { string filename= ""; int start= file.LastIndexOf('.'); file= file.Remove(start, file.Length - start); start= file.LastIndexOf("\\"); filename= file.Substring(start+1); return filename; } //---------- public static string CutOutFilename(string file, string IncludeExt_) //change IncludeExt_ to bool would be better. { string filename= ""; int start= file.LastIndexOf("\\"); filename= file.Substring(start+1); return filename; }
  8. Learn C# instead! A whole new experience!
  9. Use the GetPixel method of the Bitmap.
  10. Good thought!
  11. I don't know anything about asp or web services, sorry.
  12. Declare a static variable at the top of the class, Form2. public static string txtbox2=""; Then you can access it by using the namespace.Form2. Or, better yet, In your Form2's constructor (the method with the same name as the class; has InitializeComponent in it), do this: public Form2(Form f) { this.otherForm= f; //otherForm is a variable you will have to declare at the top. When you use otherForm in your code, it will point to f, and f points to the Form passed to it. } The call from Form1: Form2 f2=new Form2(this); To access the textbox in Form1 from Form to, you must make it public.
  13. You mean like when you override a function like OnPaint and then calls it's base? base.
  14. This is a snippet from one of my programs: public void FillRunProc() { Process[]P= Process.GetProcesses(); bool there=false; foreach(Process p in P) { foreach (string x in this.runProcLB.Items) { if(p.ProcessName==x) { there=true; break; } } if(!there) this.runProcLB.Items.Add(p.ProcessName); there=false; } there=false; string[]listProc=new string[this.runProcLB.Items.Count]; this.runProcLB.Items.CopyTo(listProc, 0); foreach (string x in listProc) { foreach(Process p in P) { if(p.ProcessName==x) { there=true; break; } } if(!there) this.runProcLB.Items.Remove(x); there=false; } }
  15. I'm not sure but I think he is talking about using the Process class to start an exe file on the hard drive, not one of his own programs. You could just monitor the Running processes and when the process you are looking for is no longer in the list, you know it is closed.
  16. VolteFace, this did not work. Still flickers the same. Bitmap b=new Bitmap(wbb.Bmp.Size.Width, wbb.Bmp.Size.Height); Graphics g= Graphics.FromImage(b); g.DrawImage(wbb.Bmp, new Rectangle(0,0, wbb.Bmp.Width, wbb.Bmp.Height)); Graphics gg=this.CreateGraphics(); gg.DrawImage(b, wbb.Bounds, wbb.ClipBounds, GraphicsUnit.Pixel); g.Dispose(); gg.Dispose(); NeOBz, Code in OnPaint should not be slow if you do it right. It should only paint part of the picture and Form when you scroll.
  17. For VB or VB.net, no. But if you know the windows api and how to use it, it works the same as you see in the code above. I'm sure you can look this topic up on the net and find some info and maybe even an example.
  18. Same pricipal as you see here. These are just api calls.
  19. Try comPortControl.comPortControl.Whatever Namespace.Class.Method
  20. Well, if the code is almost identical then maybe you are just getting lucky with the 2nd app.
  21. That's the problem with me.CreateGraphics(), it is not automatically updated when the screen is redrawn. If you want it to "stick" you must draw in a paint event or better yet an overriden OnPaint of the Form or the Panel. Then you use the SetStyle.DoubleBuffer procedure. That is the easiest way to do it.
  22. That's it? And without using SetStyle, the Image will be "blitted" to the screen; DoubleBuffed? It does not work. Bitmap b=new Bitmap(wbb.Bmp.Size.Width, wbb.Bmp.Size.Height); Graphics g= Graphics.FromImage(b); g.DrawImage(wbb.Bmp, new Rectangle(0,0, wbb.Bmp.Width, wbb.Bmp.Height)); e.Graphics.DrawImage(b, wbb.Bounds, wbb.ClipBounds, GraphicsUnit.Pixel); g.Dispose();
  23. Try not using PerformClick and make a sub that both events will use to close the Form. CloseForm() { this.Close(); }
  24. VolteFace, are you saying that you did not use DoubleBuffer from SetStyles? If so, how do double buffing with GDI+ manually?
  25. If any of the variables returns null or Nothing then you will get that error message if you try to use it. You can check it though if(body != null) {It'sOk();}
×
×
  • Create New...