|
jtmtv18 wrote:
need some open source C# help for free Christian?
LOL - no. Although I have used an open source C# lib recently that was missing features I needed, that wasn't what I had in mind.
jtmtv18 wrote:
i always wanted to see what it was like to work with another C# coder..just to see diffrent styles and to learn from what then know also
Best thing that happend to me C# wise was the screensaver contest here on CP. I did one together with James T Johnson and he taught me a great deal.
An open source project is still a *project* and will give you skills in working with others, as well as the chance to learn from them.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
i just looked at your screen saver project with james...christian you are a scarry lookin dude .j.k well next time you work on a article...let me know maybe i can watch and learn from you or something. im sure i could help but i dont think there is anything i know that you dont already....anyways thanks for all the awnsers.....to anyone else i would like to work on a project...however small a part.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Hi all
I have a Thread that adds delegates periodically to a ThreadPool. Now when I debug this in VS.NET every behaves no matter how much delegates gets queued. BUT as soon as I detach from the process, the threads starts going beserk. According to TaskMan the threads are at 35 (max i think). Breaking back into the code I see the thread is still adding delegates but when they fire, i can NOT step thru the code(ok maybe 2/3 statements). It keeps jumping back to the breakpoint.
OK As I was writing this I manage to "fix" it. It seems stable now. It appears to be from using Console.Writeline from a thread. Weird indeed.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
its becaused console.writeline blocks threads - i.e. only one thread at a time can execute it.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
|
I have a method that takes byte[] parameter.
But the data, that I want to pass into the method is
contained inside long[] array.
How to convert these types?
I c++ i would simply cast the pointer to (unsigned char*)
e.g
//============= c++
int elCount=10;
long* longTable = new long[elCount];
SomeObject.SomeFunction((unsigned char*)longTable,sizeof(long)*elCount);
In c# it looks like
//============== C#
int elCount=10;
long[] longTable = new long[elCount]
//what to do here to convert long[] to byte[]
SomeObject.SomeFunction(.....)//taking byte[] argument
Is it possible to do it without serialization or any other
"heavy" method
|
|
|
|
|
|
When doing in this way:
byteTable[] data = System.Convert.ToByte(arrayLong);
I get message from compliler:
Cannot implicitly convert type byte to byte[]
When using explicit cast:
byteTable[] data = (byte[])System.Convert.ToByte(arrayLong);
I get message from compliler:
Cannot convert type byte to byte[]
help
Michal
|
|
|
|
|
You can copy the long[] to a byte[] and back using the static methods of the Buffer class, but you will end up with two copies of the data in memory.
As an alternative, you could use a pseudo-union to get two views of the same data. You need to be very careful when you access the arrays, since the length of one array will be overwritten with the length of the other:
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
public struct IntArray
{
public const int ElementSize = 4;
[FieldOffset(0)]
private int _size;
[FieldOffset(4), MarshalAs(UnmanagedType.ByValArray)]
public readonly int[] intArray;
[FieldOffset(4), MarshalAs(UnmanagedType.ByValArray)]
public readonly byte[] byteArray;
public IntArray(int size)
{
_size = size;
intArray = new int[size];
byteArray = new byte[size * ElementSize];
}
public int IntSize
{
get { return _size; }
}
public int ByteSize
{
get { return ElementSize * _size; }
}
public byte[] GetSafeBytes()
{
byte[] ret = new byte[ElementSize * _size];
Buffer.BlockCopy(byteArray, 0, ret, 0, ElementSize * _size);
return ret;
}
public int[] GetSafeInts()
{
int[] ret = new int[_size];
Buffer.BlockCopy(byteArray, 0, ret, 0, ElementSize * _size);
return ret;
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hello - I'm an old timer with the Win32 API and MFC development environments. Have been writing code for sale in the windows environments for many years. Now thinking about the .NET C# environment and have a concern. So far as I can tell code developed within the .NET environment can ONLY be executed within a .NET environment, i.e., everyone you sell to must have installed a .NET environment. Is this in fact true?
|
|
|
|
|
|
Anonymous wrote:
you sell to must have installed a .NET environment. Is this in fact true?
Yes, even if you pre-JIT your code, at run-time the metadata referenced by your assemblies load all code from the "linked" .NET assemblies. So you need the .NET run-time (dotnetfx.exe in your cd-rom, or simply put a link to the MSDN download entrypoint).
But there is even more to that. Now that .NET 1.1 is soon out, you've got to make sure the user has the right run-time, since actually when he starts your app, by default the app is going to load 1.1 assemblies (hard-coded in the metadata). The only way to get around it is to provide a .config file to route to an "older" .NET run-time. You can use the .NET applet in the control panel to build it.
|
|
|
|
|
Ahhh, I understand! Another versioning problem! It's getting tough to support the marketplace! Thanks for the info - very helpful.
|
|
|
|
|
Java has the same problem with newer apps that require a specific runtime, older apps not working on newer runtimes, heck, runtimes in general -- and J2EE apps behave differently on differing app servers...
...CORBA has problems in ORB implementations...
...and the Mono .NET open source project should also add some gas to the version fire
|
|
|
|
|
Hi,
Anyone knows how to detect the type of a font?
Because in my font combo I want to put the right icon for true type or open type
Tnx in advance
Gogou
|
|
|
|
|
Has anyone managed to do this? I wish to add a control (other than check/radio) to a menu item so that when I mouseover a top level/sublevel menu item, a sub menu will open with the control on.
"Where would you rather be today?"
|
|
|
|
|
I can't say I've ever seen a derived menu item that could host a control, but it would be very easy to implement - simply position your control using the bounds property of a derived MenuItem, something like this:
myControl.Bounds = this.Bounds;
myControl.Visible = true;
myControl.BringToFront();
myControl.Focus();
use mouse events to show/hide the control as necessary..
That said, controls in menus would certainly not be considered acceptable UI design around my office
|
|
|
|
|
The MenuItem Class has no Bounds property. The only thing I can think of is the OnDrawItem() override. I've used this to draw stuff to the menuitem. HOwever setting the control to use the System.Windows.Forms.DrawItemEventArgs.Bounds property doesn't seem to cut it.
<br />
public class ControlMenu : System.Windows.Forms.MenuItem<br />
{<br />
<br />
public TrackBar track;<br />
<br />
<br />
public ControlMenu()<br />
{<br />
<br />
track = new TrackBar();<br />
this.track.Name = "trackBar1";<br />
<br />
this.track.Orientation = System.Windows.Forms.Orientation.Vertical;<br />
this.track.Size = new System.Drawing.Size(42, 144);<br />
this.track.TabIndex = 13;<br />
this.track.Value = 10; <br />
<br />
} <br />
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)<br />
{<br />
base.OnDrawItem(e);<br />
<br />
track.Bounds = e.Bounds;<br />
track.Visible = true;<br />
track.BringToFront();<br />
track.Focus();<br />
}<br />
I've tried having base.OnDrawItem(e); before and after the bounds setting code, without any luck.
Any Ideas?
"Where would you rather be today?"
|
|
|
|
|
You may need to have the trackbar as a child to the hosting form rather than your menu item, and reference it with public properties.
I'll have a play with it later if you like.
|
|
|
|
|
Furty wrote:
You may need to have the trackbar as a child to the hosting form rather than your menu item, and reference it with public properties.
Eventually its gonna be used on the Notify Icon context menu for an app i'm working on, but for now i'm just having it as a form menu item. Thus, the Trackbar will need to be independant of the form as the NotifyIcon is not related to the form.
I'm leaving it for today and going to watch some TV like the couch potatoe I am. If you find anything out in the mean time I'll be glad to hear
"Where would you rather be today?"
|
|
|
|
|
OK, I've done a little testing and the major problem seems to be the fact that Menu and MenuItem do not derive from System.Windows.Forms.Control. Form what I can see, the only way to acheive your goal would be to override the OnDrawItem and OnMeasureItem methods, and paint the control yourself. Naturally you would also need to handle mouse events etc for user interaction.
The bottom line is that it's a big task, you might be better off using one of notify icon ballon implementations here on CP, as they derive from forms, and therefore can host controls no problem.
Hope this has helped..
|
|
|
|
|
possibly (maybe) the magiclibrary may have what you are looking for ?
The Code Project Is Your Friend...
|
|
|
|
|
Dear Sirs,
Please guide me how I can send Mails in .NET via an SMTP Server which requires SMTP Authentication.
Regards,
Sassan Komeili Zadeh
|
|
|
|
|
Hmm...
There have been umpteen articles on this topic in C#.
MailMessage msg = new MailMessage();
msg.From = "crawler@deepak.portland.co.uk";
msg.To = "crawler@deepak.portland.co.uk";
msg.Subject = "Test";
msg.Body = "Hi! Hello" +"\nSent Via MailMessage and SmtpMail Class";
SmtpMail.SmtpServer = "smtp.yourmailserver.yourisp.com";
SmtpMail.Send(msg);
SmtpMail.Send("crawler@deepak.portland.co.uk","crawler@deepak.portland.co.uk","Test","Hi! Hello\nSent Via SmtpMail class");
Include System.Web.Mail namespace for the above methods to be visible to the compiler.
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
Deepak Kumar Vasudevan wrote:
There have been umpteen articles on this topic in C#.
But he was asking about SMTP with authentication....;P
MyDUMeter: a .NET DUMeter clone
|
|
|
|