|
hmm.. i'm not a c++ guru, but i once wrote a little c++ demo lib that was callable from c# and i'm not sure if this is important, and if you can do anything about it but:
1) in my method-declaration i used the stdCall keyword:
void __stdcall foo(unsigned int *param1, unsigned char *param2, unsigned char *param3, void *Handle)
--> i think the default calling convention for pInvoked Method is stdCall so if it's not declared that way it might fail..
2) in the exports.def of the library i had to put this in order to make it work:
EXPORTS<br />
foo @1
--> if this is missing, it might explain the EntrypointNotFound - exception
greets
m@u
|
|
|
|
|
Hello friends,
I hope this is the right forum to place this question, if it isn't, please apologize me.
I'm thinking in taking the C# certification examinations and I need some help finding the right book or documentation to study.
If any of you did it before, perhaps can give a hand telling me the books you used so I can buy it.
Thanks a lot.
|
|
|
|
|
|
|
Thanks for all your answers. Help very appreciated.
I will check them and get the book.
pd: Any other opinion is welcome.
|
|
|
|
|
Hello.
I am trying to write the text given by the user onto an image and save the image. If i save it once using the Save method of the Bitmap object, it works. But if i try again, i get an exception because the file is locked. I have to restart the application to save the file again. Does anybody know a solution?
Thanks
|
|
|
|
|
Yes, make sure you Dispose of any Bitmap or File you are using!
|
|
|
|
|
I did that. Here is my code:
Font f = new Font("Arial", 48);
Bitmap b = new Bitmap("some path");
Graphics g = Graphics.FromImage(b);
g.DrawString(textBox.Text, f, Brushes.White, 50, 50);
g.Flush();
try
{
b.Save("result path", ImageFormat.Jpeg);
b.Dispose();
b = null;
pictureBox.Image = Image.FromFile("result path");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message); //Displays "A generic error occured in GDI+"
}
I wrote the message on the forum after i tried this code. So Dispose doesn't really work as I had expected. Any other ideas?
|
|
|
|
|
Hi,
images that get created from a file, lock that file for as long as the Image exists.
This holds true for Bitmap b=new Bitmap(path) as well as pictureBox.Image = Image.FromFile(path) .
As long as your PictureBox is showing an image, loaded from a file like that, you won't be
able to delete or modify that file.
There are basically two solutions:
1. load the image, copy it to a second image immediately (as in new Bitmap(image) ), and dispose of the first image;
2. create a FileStream to the file, and load the image using FromStream, this does not lock
the file that your stream refers to.
FileStream stream=new FileStream(fileSpec, FileMode.Open, FileAccess.Read);
Image localImage2=Image.FromStream(stream);
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Dear All,
I'm really stuck with my serial communication algorithm.
I receive the binary number sent to the serial port properly as "1000001" when i check in the hyperterminal, but i cannot convert it to the corresponding decimal value using my C# program.
Any help regarding this will be really appreciated.
Thank you.
|
|
|
|
|
Hi
Is this a string containing "10000001"? if so, and you want to convert it to an int or a long, you can use the Convert.ToInt32 or Convert.ToInt64 method:
long l = Convert.ToInt64("110101101",2);
greets
M@u
|
|
|
|
|
oh my - never noticed that you can convert from different bases - thx.
|
|
|
|
|
Hi,
i'm beginnig to write the code for a drag/drop component.Basically,i want to create a map-like control,where the user can drag & drop items chosen from a set.
So i will have a control's portion with the items to choose from (with a drag operation) and a "work" area where to drop the chosen items.
Now i'm concerned about various things(like zooming,handling the size of the map when there are many items in the map etc...),and,most important,i am still a newbie developer,so,before starting from scratch, i ask you:do you know some similar control/example that could put me on the right way?
Surely something similar to Microsoft Visio would help,but i need some sample code
Thanks in advance!
|
|
|
|
|
I would use the scrollwheel event within the "work" area to zoom, and set the AllowDragDrop property on the same to "true". Then override the OnDragEnter (or OnDragOver) and OnDragDrop methods for the "work" area. In the source area, override the OnClick and MouseMove event handler to start the drag (Using a call to DoDragDrop on the object). There is an article on MSDN about drag-drop into textbox here[^]. Hope this helps,
-Jeff
|
|
|
|
|
Can any one please tell me how to make entire grid editable.
I have done the usual way of making only the particular Row editable when cliked on EDIT button on the Row.
But I have to make the entire grid editable on a button click ..
Thanks in advance
|
|
|
|
|
Get it
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Hello,
I was playing around with the listbox control in visual c# express edition and I become frustrated when I couldnt find events such as OnInsert / AfterInsert and so on. Has Microsoft reduced events?
|
|
|
|
|
There has no OnInsert or AfterInsert, but listbox has ControlAdded and ControlRemoved, see if it's help.
|
|
|
|
|
I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?
|
|
|
|
|
Deian wrote: I have looked at both events(ControlAdded and ControlRemoved) prior to my post, the documentation states they are for controls, not items. How to get notified after new item has been added to the listbox ?
I had encountered the same problem before. I couldn't find any such event that was usable. What I ended up doing, while it was extremely generic, was take a collection of all the items in the listbox, and compare the collection and the list, and when the count is different, you can "fire your event." It is pretty simple to find the item that has been added or removed.
Like I said, it is pretty generic and crappy. But, it got the job done. Worked just fine for me.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks for the replies. There are several ways to get out of the situation, but I tought that I am missing something when reading the documentation.
Regards,
Deian
|
|
|
|
|
Deian wrote: I tought that I am missing something when reading the documentation.
Oh, unfortunately, and strangely enough, you are not.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
hi
My aim is to bind the combobox with two fileds of a database
i mean that whenever i click on the combobox , the boxes must contain two fields .....example of that is a name with its id ....
if anyone is having any idea abt this then please let me know
regards
sindhu tiwari
its me sid
|
|
|
|
|
Are you want the combobox contain the display and the id of the display name?
If so, set the DisplayMember and ValueMember to the combobox. When SelectedIndexChanged you can get the SelectedText and SelectedValue
|
|
|
|
|
I am using the concept of satellite assembly in my application.I have created two satellite assemblies as Satellite.fr-FR.resources.dll and Satellite.en-US.resources.dll for french and english respectively.
I have initialize resource manager as:-
ResourceManager rm = new ResourceManager("Satellite." + System.Globalization.CultureInfo.CurrentCulture.Name, Assembly.GetExecutingAssembly());
From the above code the application automatically detects the current culture of the system.Depending on the current culture I am setting the labels text on a form like this:-
private void button1_Click(object sender, EventArgs e)
{
SetText(this);
}
void SetText(Control ctl)
{
string text = rm.GetString(ctl.Name);
if (text != null)
ctl.Text = text;
foreach (Control ctl1 in ctl.Controls)
{
SetText(ctl1);
}
}
I am trying to find out a way by which my application set the Labels text itself when ever the system language changes. I mean i want to get rid of SetText() method written above.Is there any way by which I don't have to write any method like SetText() for setting all my controls text.If any one has any idea then please let me know.
Thanks.
|
|
|
|