|
Bitmap bitmap = (Bitmap)image;
|
|
|
|
|
This obviously won't work.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
This is terrible code. Very inefficient. Is GetPixel a method in the Bitmap class and not Image ? This will make your code even less efficient, but the way to do it is
Bitmap b = new Bitmap(myImage);
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I have just created a test project and pasted your code into it. It works perfectly.
So, question. What event are you handling with freezeFrame_MouseClick ? You see I tried it with both MouseClick and MouseDown of the PictureBox , and it worked for both.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi dudes!
Does anyone know how can I change the version of my config files?
Why does it just accept 1.0?
|
|
|
|
|
Assembly Version: 1.0.*
and Clear all the File version.
*12Code
|
|
|
|
|
Thanx! So the config file version cannot be more detailed!
|
|
|
|
|
I get this error, even though I don't know why.
The code throwing this error is this:
bool ReadIni()
{
try
{
string error = "";
try
{
}
catch (Exception ex)
{
}
if (ini != null)
{
}
else
{
for (int i = 0; i < 5; i++)
{
conversion[i] = false;
}
}
if (error != "" || ini == null)
{
MessageBox.Show(error + "\r\nPlease input the missing values", "Input missing
values", MessageBoxButtons.OK, MessageBoxIcon.Error);
F_Manual_Input forminput = new F_Manual_Input(conversion, values, inipath);
this.Show();
forminput.ShowDialog();
this.mapsize = new Size(forminput.MapWidth, forminput.MapHeight);
this.tilewidth = forminput.TileWidth;
this.tileheight = forminput.TileHeight;
return false;
}
else
{
this.mapsize = new Size(sizeX, sizeY);
this.tilewidth = tileX;
this.tileheight = tileY;
this.imagewidth = sourceX;
return true;
}
}
catch (Exception ex)
{
MessageBox.Show("An error occurred while reading the ini file:\r\n" + ex.Message,
"System Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} The final if/else block causes the error.
Even if I out comment it and write return true; instead, I get the same error.
But I don't know why I get it in the first place.
All the code before the final if/else block will just be executed one after another normally and there are no unresolved if blocks or anything, no way the method could stop there.
And the final if/else block catching 2 different cases, but also returns avalue in all other cases.
I'd really appreciate if you could tell me what went wrong.
|
|
|
|
|
Megidolaon wrote: else
{
//set map/tile size and image width with values from file
this.mapsize = new Size(sizeX, sizeY);
this.tilewidth = tileX;
this.tileheight = tileY;
this.imagewidth = sourceX;
return true; //input was read from file
}
add another
return false;
after the code.
*12Code
|
|
|
|
|
I still get the same error.
In fact VS tells me it's unreachable code.
|
|
|
|
|
Just put return statment after the catch blok,
catch (Exception ex) { MessageBox.Show("An error occurred while reading the ini file:\r\n" + ex.Message, "System Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
return false;
|
|
|
|
|
The method is supposed to continue if there's an error with read the ini file in the first place (like missing file, etc.).
The user must enter the values manually and the application will create the ini from scratch.
|
|
|
|
|
Declare a local bool variable first and then set the variable to either true or false in the IF ELSE blocks. In the end return the variable
The code should look like the following...
bool ReadIni()
{
bool returnValue = false;
try
{
}
catch (Exception ex)
{
}
return returnValue
}
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Yeah, it never happened to me, but I realized that in case of an exception, that exception is caught and afterwards the application continues normally.
Thus in this case it also need a return value.
|
|
|
|
|
I have a project in C#. Now i have this problem: after installing this software it should be disabled and the user must register it in our website, then with an activation key that would be given in the website the software should be enabled again!
I really know nothing about how it should be done.
Would anybody please help me???
it's so urgent!!!
Roshanak
|
|
|
|
|
Urgent for who?
Simple: have the startup check for a value in the registry that is an anagram "satryuopoied". If it's not there phone home.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
yes, i found it.
now i have my own software, you mean if i install it (for example with windows installer) it creates this registry key for it's own and then i can do what i want??? or i must insert the creation of this key in my code????
Roshanak
|
|
|
|
|
Try googling registration-activation and similar terms.
Try looking on codeproject for registration-activation.
There is no fool-proof method - if there was M$ would use it already. Decide on a method that is good enough for your needs.
Simple approach is for the user to provide certain details and you give back a hash code based on the details. If the activation details and hashed code do not match the software say no!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I want to create binary file ex"test.dat" And want to write excel data in that how to do this?
Please help me with code
|
|
|
|
|
|
Hi guys,
I have written a simple console program which will accept username and display it. Now I want that along with this simple function, the program also copies itself to a particular location, say C:/Program Files. Such that the user need not copy and paste it to the above location systematically. Is the code something like this:
this.copy("C:/Program Files");
But this doesn't seem to work and I get errors. Whats the correct code for this then? Remember that I want the entire program to copy itself (replicate) to that location.
Your help will truly be admired,
Rajdeep.NET
|
|
|
|
|
Use setup to redirect your files to c:\Program Files.
*12Code
|
|
|
|
|
Will I have to create Setup for a small console application like this? Sorry, its my fault. Its a console program. Tell me how would I programetically do the stuff?
|
|
|
|
|
Please use setup. This is what the setup for. Setup is easy to create in VS, why not use it?
Program can't relocate itself to other location.
*12Code
|
|
|
|
|
Rajdeep.NET wrote: this.copy("C:/Program Files");
But this doesn't seem to work and I get errors
I do enjoy a good laugh in the mornings
You cant just write code like that and expect it to work. others i would frequently use...
this.FinishTheRestForMe();
And you certainly cannot move/copy an program that is running. As has been suggested you will want to use a setup for your requirements, even if its just a little console application.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|