Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.

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.

Posted
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?

Posted
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.

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.

Posted

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

Posted
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.

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.

Posted

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.

Posted

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));

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.

Posted

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.

Posted
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]

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.

Posted

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.

Posted

try

System::Drawing::Rectangle *r =  __nogc new System::Drawing::Rectangle(75,20,462,270);
this -> Invalidate(r);
Application::DoEvents();

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...