|
It's ok guys, thanks for the replies. I found out what was happening. Basically a dll that contains a data holding class was apparently the wrong version which I discovered indirectly. Without this other app I would never have discovered the problem due to something catching uncaught exceptions in a C# Windows Service. Here's another one though, does anyone know why uncaught exceptions from a service do get caught somewhere and not logged?
Thanks again guys
Andy
Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
|
|
|
|
|
Hi,
I am trying to build a html in my c# project, which is used for show different tables or joint tables in the database. I don't know how to do that. Can anyone help me?
Thanks in advance!
|
|
|
|
|
I load my default mail clien(Outlook express).I want to put some files in attachment field(Runtime).I cann't understand where is reference to these files.
Process p = new Process();
string toemail = "somebody@server.com";
p.StartInfo = new ProcessStartInfo(@"mailto:"+toemail);
p.StartInfo.UseShellExecute = true;
p.Start();
|
|
|
|
|
Hi there:
I've faced with a silly bug in Menu , I dont know if u had it or not, but I'll be thankful if could help me!
The problem is when u set ur menu Left to Right, & WindowState to Maximized every thing changed!
I mean when menu is Left to Right & windows should start in Maximized mode! even when its normal & the shortcut seted to Maximized!!!
I dont know how I can describe it, so please try it once & look what happend?!
Any help is appreciated!
Always,
Hovik Melkomian.
|
|
|
|
|
Hi,i try to hold a number arraylists in a single main arraylist.But i think because of a referance problem, everytime i add a new arraylist, previous added lists became same with last added one;all items shown as the last arraylist's items.is anyone knows the solution or a different way to hold arraylists?
Thanks
|
|
|
|
|
Array is an object. You are trying something like:
ArrayList a1,a2;
a1=new ArrayList();
a2=new ArrayList();
...
a1.Add(a2);
...
a1.Add(a2); // thesame array
should be:
ArrayList a1,a2;
a1=new ArrayList();
a2=new ArrayList();
...
a1.Add(a2);
a2=new ArrayList();
...
a1.Add(a2); // another array
Hi,
AW
|
|
|
|
|
Thanks but a have already use this.maybe it would be more clear if i send my code
private ArrayList ALMainList=new ArrayList();
private ArrayList ALSendedList;
...
MyArrayList.Add("al1");
CatchSendedList(MyArrayList)
...
MyArrayList.Add("al2");
CatchSendedList(MyArrayList)
...
MyArrayList.Add("al3");
CatchSendedList(MyArrayList)
...
public void CatchSendedList(ArrayList ALSendedL)
{
ALSendedList=new ArrayList();
ALSendedList=ALSendedL;
ALMainList.Add(ALSendedList);
}
when i use this code i take the result:
ALMainList-item0 -> al3
ALMainList-item1 -> al3
ALMainList-item2 -> al3
|
|
|
|
|
You're just copying references around. When you write
ALSendedList=ALSendedL;
you're merely copying the reference to the array list, you are not copying the array list itself. You need to think about copying the items in the array list instead.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
... or use CopyTo() method (not Clone())
Hi,
AW
|
|
|
|
|
.NET security sample anyone? There's a good/short article from Code Project by "Manuel Permuy": http://www.codeproject.com/csharp/cryptography.asp
The sample illustrates how to encrypt/decrypt/retrieve certs using WSDK.
QUESTION: I can do all this without WSDK - using just System.Cryptography? I'm new to this and I am looking for nice/short .NET examples (otherwise, i'd be reading MSDN):
1. sign/hash/encrypt data
- both PPK and classic symmetric algo (DES for example).
2. Also want to know how to "publish" your public key so receiver decrypt payload and verify signature (in your sample, client and receiver on same machine/process.) So, am I talking about exporting key/key blob? A handle to a key is meaningless on a remote machine.
3. retrieve certificates from cert stores (covered in this article)
4. add cert (makecert.exe or MMC/3rd party: I'm alrite with this.)
Any good articles? I want to do this all .NET - but as you mentioned, you don't get .NET support in dealing with cert stores. Is that still true?
Thanks.
norm
|
|
|
|
|
I try to send mail to the oher server ,but I cann't send it.Every time when I try, I have this kind of exception: Could not access 'CDO.Message' object.
I am sure that I had installed and runing SMTP service and CDO.
MailMessage mailMessage = null;
MailAttachment mailAttachment = null;
//GetMessageInfo(mailMessage);
mailMessage = new MailMessage();
mailMessage.From = textBoxFrom.Text;
mailMessage.To = textBoxTo.Text;
mailMessage.Subject = textBoxSubject.Text;
mailMessage.Body = textBoxMessage.Text;
//GetMessageAttachment(mailAttachment,mailMessage);
if(textBoxAttachment.Text != "")
{
if(File.Exists(textBoxAttachment.Text))
{
mailAttachment = new MailAttachment(textBoxAttachment.Text, MailEncoding.Base64);
mailMessage.Attachments.Add(mailAttachment);
}
else
{
MessageBox.Show("The file do not exist");
}
}
SmtpMail.SmtpServer.Insert(0,"mail.yahoo.com");
SmtpMail.SmtpServer = "mail.yahoo.com";
mailMessage.BodyFormat = MailFormat.Text;
SmtpMail.Send(mailMessage);
MessageBox.Show("Done");
|
|
|
|
|
There are twp possible reasons:
1. mail.yahoo.com cannot be found
2. mail.yahoo.com does not accept your email. Maybe your not logged in.
Catch the exception and check the inner exceptions, mostly they are more informative.
|
|
|
|
|
I'm trying to write a game in C# to learn the language.
It's a mini clone of civilization III.
The main game window is a map, drawn with tiles (20x20 tiles right now).
To draw the map, I have somewhere a Bitmap that I store as backbuffer, where I draw the tiles themselves. Then to animate the sprites I use this "map bitmap", and draw the sprites above it.
To draw a tile, I have canvas in memory, with all the braw bitmaps (they contains 9x9 tiles), I select the right tile (-> creation of a source rectangle, corresponding to the right tile in the canvas), then I draw it in my Bitmap, after having found the destination rectangle.
So basically it's something like
graphics.Draw(CanvasBitmap, SourceRectangle, DestinationRectangle).
I have some problem with speed : rendering 20x20 tiles (each is 128x64) takes 950 ms. As I need to render it anytime I scroll (because the map is 200x200, but the viewport is only 20x20), it is not acceptable.
Is there a way to speed the process using only GDI+ and C#?
Must I use direct X?
|
|
|
|
|
Try this approach:
Choose the graphics surface of a PictureBox control instead of drawing on a Bitmap object, I mean do your drawing in OnPaint event of PictureBox control(and use e.Graphics ). This way you can use benefits of auto scrolling that PictureBox control has. And also speed is more acceptable than when you draw on a Bitmap object.
I hope this helps
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
I can' do this, because I want to precalculate the map backgrounds only when the user wants to scroll. Then moving sprites on the map doesn't need any change in the map itself, so I will use the precalculated bitmap.
|
|
|
|
|
Meisi wrote:
This way you can use benefits of auto scrolling that PictureBox control has. And also speed is more acceptable than when you draw on a Bitmap object.
For a business app maybe.
BitBltFast would actually be the wiseest choice. picture boxes are slow.
I only say this because I'm writing a game in c# right now and have discovered the the GDI+ sucks
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
something not right here.
- are you drawing all 400 tiles each time?
- are you moving them onscreen in one move or 400 moves?
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I draw all the 400 tiles each times, because if the user clicks on the globalview "somewhere", I need to redraw all of it.
However, I do it only when the map change (scroll or editor change of terrain), no when things in the layers (a unit animation change).
I move them on screen in one move : I start by drawing them in a bitmap, which is stored, and then in the render function (with a timer), I draw the stored bitmap in the PictureBox.
This last part is fast. I don't understand why drawing the 400 128x64 tiles in the backbuffer is so much longer than drawing the whole image in a 1024x768 PictureBox?
|
|
|
|
|
becuase its 400 times more work....
you need less calls
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
you should cache your whole "world".
i.e. make your buffer as big as the world, and only redraw those in the 400 that have changed.
this way you should only have to do a few redraws..
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
World = 200x200 tiles.
Tile = 128x64 pixels.
As they overlap (isometric view),
let say it's 100x100 tiles.
That's still 81 920 000 pixels... Isn't it to much to store the whole background?
|
|
|
|
|
yes that is pretty big...
maybe you need to reconsider how you draw your world - maybe tiles are not a good idea...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Before I did this
graphics.DrawImage(backgroundSprite.Canvas.PictureFile,destinationRectangle,backgroundSprite.SourceRect,GraphicsUnit.Pixel);
and I had in memory one file with 9x9 tiles. I selected the tile from the source rectangle, and copied it in my PictureBox.
Now I have that :
graphics.DrawImage(backgroundCanvasArray[BackgroundCanvas].TilesArray[line,column],offsetX,offsetY);
and I have an array of tile 9x9.
Initialization is a bit longer, as I have to break my 9x9 tiles images into 81 images in an array.
But then, for the rendering I simply draw the tiles directly at the offset, without specifying a source and destination rectangle.
Result : rendering time for a 20x20 tiles world has dropped from 950 ms to 30 ms.
What took time was the resampling of the image to fit the new size, EVEN IF IT WAS THE SAME SIZE.
Now it works well enough
|
|
|
|
|
glad to here you fixed it!
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Well your first and biggest mistake is not using direct x as a window in your application. GDI sucks for that type of application
Second you need to redraw based on regions.
My advice:
get rid of gdi+ dont even bother with it.
learn direct x and set up the buffered pages
one for the map, cities, and the objects then flip the pages and you ll get plenty of speed
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|