Omnibus Posted August 30, 2004 Posted August 30, 2004 Does anyone know how Invalidate(); can be applied on only part of the form in managed VC++.NET? Thanks in advance. Quote
Joe Mamma Posted August 30, 2004 Posted August 30, 2004 Does anyone know how Invalidate(); can be applied on only part of the form in managed VC++.NET? Thanks in advance. put the area you want to invalidate on a pahodnel and call the panels invalidate method, or pass a rectangle to the Forms invalidate method. UI find using a panel easier. no need to calculate the rectangle. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Omnibus Posted August 31, 2004 Author Posted August 31, 2004 put the area you want to invalidate on a pahodnel and call the panels invalidate method, or pass a rectangle to the Forms invalidate method. UI find using a panel easier. no need to calculate the rectangle. Can you possibly give an example code in managed VC++.NET as to how to do that? Quote
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 Can you possibly give an example code in managed VC++.NET as to how to do that? boy my typing was attrocious. I swear I wasnt drinking! pahodnel = panel (boy that was a weird one) there is a basic example in the help. llok up rectangle and region for examples for creating thos. . . they can be passed as arguments to Invalidate. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Omnibus Posted September 1, 2004 Author Posted September 1, 2004 I can't figure out how to do that. As far as I understand from the help the rectangle should be created by something like this: HDC hdc; BOOL Rectangle( hdc, // handle to DC 75, // x-coord of upper-left corner of rectangle 20, // y-coord of upper-left corner of rectangle 462, // x-coord of lower-right corner of rectangle 270 // y-coord of lower-right corner of rectangle ); This, however, gives me error C2078: too many initializers error C2078: too many initializers Quote
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 I can't figure out how to do that. As far as I understand from the help the rectangle should be created by something like this: HDC hdc; BOOL Rectangle( hdc, // handle to DC 75, // x-coord of upper-left corner of rectangle 20, // y-coord of upper-left corner of rectangle 462, // x-coord of lower-right corner of rectangle 270 // y-coord of lower-right corner of rectangle ); This, however, gives me error C2078: too many initializers error C2078: too many initializers try Rectangle rect = Rectangle( 75, // x-coord of upper-left corner of rectangle 20, // y-coord of upper-left corner of rectangle 462, // x-coord of lower-right corner of rectangle 270 // y-coord of lower-right corner of rectangle ); controlPtr -> Invalidate(rect); or simply controlPtr -> Invalidate(Rectangle(75,20,462,270)); I dont know, my C++ is shaky. I dont use it for GUI - only for low level I/O. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Omnibus Posted September 1, 2004 Author Posted September 1, 2004 Obviously managed VC++.NET has some peculiarities which don't allow code written for unmanaged C++ to compile. The only way the code compiles is by writing: public __value struct ClipRectangle Invalidate( ClipRectangle ); However, this doesn't do any good because ClipRectangle seems to encompass the entire form. I don't know how to declare ClipRectangle to be a specific portion of the form. The declarations you give above do not seem to apply in this case. Quote
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 System::Drawing::Rectangle *r = __nogc new System::Drawing::Rectangle(75,20,462,270); ctrlPtr -> Invalidate(r); or ctrlPtr -> Invalidate(__nogc new System::Drawing::Rectangle(75,20,462,270)); Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Omnibus Posted September 1, 2004 Author Posted September 1, 2004 Thanks. Both codes compile well but with no apparent result. I also tried it like this: System::Drawing::Rectangle *r = __nogc new System::Drawing::Rectangle(75,20,462,270); public __value struct r; this->Invalidate( r ); This also compiles well but the result is again zilch. Quote
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 Thanks. Both codes compile well but with no apparent result. I also tried it like this: System::Drawing::Rectangle *r = __nogc new System::Drawing::Rectangle(75,20,462,270); public __value struct r; this->Invalidate( r ); This also compiles well but the result is again zilch. public __value struct r; redeclares it and sets it to null. . . try this->Invalidate( r, true );[/code] Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Omnibus Posted September 1, 2004 Author Posted September 1, 2004 Gives the following error: error C2664: 'void System::Windows::Forms::Control::Invalidate(System::Drawing::Rectangle,bool)' : cannot convert parameter 1 from 'System::Drawing::Rectangle __gc *' to 'System::Drawing::Rectangle' When hitting 'Continue' the program works but the above Invalidate again has no effect. Quote
Joe Mamma Posted September 1, 2004 Posted September 1, 2004 try System::Drawing::Rectangle *r = __nogc new System::Drawing::Rectangle(75,20,462,270); this -> Invalidate(r); Application::DoEvents(); Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
Omnibus Posted September 1, 2004 Author Posted September 1, 2004 This is the solution: Invalidate(System::Drawing::Rectangle(75, 20, 1000, 250)); Thank you so much for your help and all the best. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.