Jump to content
Xtreme .Net Talk

jedbartlet

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by jedbartlet

  1. I was wondering if anyone could give me some help on the best way to open a bitmap file. My main objective is to open a file and manually change some of the pixel values. I know how to open standard text files but don't know how to open a bitmap file. I'm aware that a bitmap contains a header file which tells you the image size and other details. By the way i'm using vc++. Thanks in advance.
  2. Is it possible to add extra parameters to event handlers. I want to add an id number to the event handler i defined so that i can see which object in the array has made the call. Is this possibele or are the only parameters allowed Object *sender, EventArgs *e? Any feed back appreciated.
  3. Does anybody know where i can get a copy of the opencv c++ image library and is it any good? All i want is a few basic image manipulation functions such as converting colour images to black and white and edge detection. Just wondering if there is maybe a better library to use or not? Has anyone had any experience using it and if so would they reccomend it?
  4. void MyForm::InializeComponent(int x) { //All static form properties and components set here .... PictureBox *Gallery[] = new PictureBox *[x]; for(int i =0; i<Gallery->Length; i++) { Gallery = new PictureBox; Gallery->BorderStyle = BorderStyle::Fixed3D; // more properties set here.... Gallery->Click += new EventHandler(this, pbox_Click); } } void MyForm:: pbox_Click(Object *sender, EventArgs *e) { Gallery[2]->Size = Drawing::Size(100,100); //other stuff } Thats the gist of it. I get an undeclared identifier "Gallery" in the debug window which occurs on the gallery[2]->Size.... line in the event handler. I thought the problem was that when i assign the event handler i'm using the this pointer instead of a pointer to gallery but i can't get it to accept Gallery[] or *Gallery[] or anything similar. I think i'm missing something obvious but the more i stare at it the more confused i get!
  5. Bear with me if this seems like a basic question cos i'm quite new to c++.net. I've dynamically created an array of picture boxes at runtime, the number of which depends on what value the user enters. I've assigned each box an event handler for when the user clicks on that box. The prolem i'm having is that i can't access any of the properties of the picture box from the event handler. Can anyone help?!
  6. A slightly simplistic solution maybe but why don't you just create a second copy of the resource files you are trying to access with both applicatios and run an update everytime they gey altered?
  7. I'm a third year student doing final project on face recognition using neural networks. A book i found usefull for setting the groundwork on artificial intelligence, in particular neural nets was Artificial Intelligence Third edition by Patrick H. Winston. A much more detailed and practical book that i've just started on and has been recomended to me by several people is Practical Neural Network Recipes in C++ by Morgan Kafmann. Although this was published in 1993 so a newer more up to date edition may be available. Good luck!
  8. Forgive me if this question is rather simplistic but i'm relatively new to this. I'm making a windows app that involves opening and closing a lot of files. There is however more than one button on the form i've created that can be used to open the files. Is it ok to use the same openFileDialog component with each button or should i use a different dialog for each button? I'm only worried because i had the thought that using the same dialog might create some sort of conflict. :confused:
  9. Out of curiosity what is the preferred language in industry, C++ or C#. Or does it vary from organisation to organisation. Where does jave fit in other than in web based applications.
  10. And voila! got it working! Ironicly if you look at the code in my first post i pretty much had it right to begin with, just didn't create the array properly. Won't be making that mistake again in a hurry! Thanks for the help. One last question is it much of a leap from C++ to c#. You're about the tenth person who's suggested C#. Out of choice i'd have chosen c# but at uni we're taught delph initially then c++. The code samples i've seen seem straight forward enough but trying to learn the two languages at the same time could get confusing.....
  11. The error seems to occur whenever i try and change the first property of the panel which occurs at the first line in the for loop. I'm giving no_boxes the value 5, i've tried other values but the result is the same. I think the error is to do with pointers because when i run the program in the watch window i can see that an array of the correct size is being created. The watch also gives the following info- box [0], [1].....[4] value is <undefined value>. Does this mean that the panels are not being created properly?!
  12. The code compiles but again as with my initial code i get a runtime error. Panel *box[] = new Panel *[no_boxes]; for(int i=0; i<no_boxes; i++) { box->BorderStyle = BorderStyle::FixedSingle; //more properties set here } this->SuspendLayout(); this->tsetGbox->Controls->AddRange(box); this->ResumeLayout(); Runtime error message: An unhandled exception has occurred......... Object reference not set to an instance of an object. It sounds to me like i've gone over the bounds of the array but i can't see how thats possible. This is really startin to bug me now! Once again any help appreciated.
  13. No joy! A syntax error :identifier 'box' stops compilation. _________________________________________ it's amazing how stupid the little things make you feel when you can't get them working!
  14. That was the exact code i came up on my first attempt. Unfortunately it doesn't compile. A syntax error * is displayed. Initially i thought that the * after new wasn't needed but removing it gives rise to a lot more syntax errors.
  15. That's the problem, i don't know the size of the array because it is set at runtime via the function parameter no_boxes. I don't really want to have to create an array of size 100 when my default size is closer to 6! Any other suggestions?!
  16. I'm trying to display a number of panels on a form. The number of panels is determined by the user. I would like to create the panels dynamicly. The code i came up with is as follows: void MainForm1::setLayout(int no_boxes) { Panel *box[]; for(int i=0; i<=boxes; i++) { box = new Panel(); box->BorderStyle = BorderStyle::FixedSingle; //more properties set here.... } this->SuspendLayout(); this->tsetGbox->Controls->AddRange(box); this->ResumeLayout(); } When i run the app i get the following error message at runtime: Object reference not set to an object instance. Am i forgetting to use the this pointer somewhere or is it something else. I'm relatively new to visual C++ in case you can't allready tell! Any help apreciated.
  17. Problem Solved! It works thanks a lot. It seems a strange way of doing it but i'm happy! Thanks. :D
  18. I had the same thought and tried the same thing myself but now the code won't compile! There seems to be an error on the line: face = Image->FromFile( openFileDialog1->FileName ); The debugger tells me i've made a class type error. I tried substituting . for-> but to no avail. This is really starting to bug me now!
  19. Thanks for that. I've altered the code and now it compiles but the image on the picturebox remains blank. Image *face; openFileDialog1->ShowDialog(); face->FromFile(openFileDialog1->FileName ); pictureBox1->Image = face; pictureBox1->Update(); //also tried using refresh Any ideas?!
  20. I've only recently started using Visual C++ in the .NET environment but have quite a bit of previous C++ experiemce. I'm embarassed to admit that i'm having a problem loading an image into a picture box at runtime. In the button click event handler i have the following: openFileDialog1->ShowDialog(); pictureBox1->Image = openFileDialog1->FileName; When I compile i get a type error (string to image). I can see why i'm getting the error but can't see how to get round it. (i usually use delphi for windows apps!) Any help appreciated.
×
×
  • Create New...