Home > Software engineering >  Is there a way to refresh a control alone?
Is there a way to refresh a control alone?

Time:01-19

For example I changed the text of a static text control, the old text and xinwen will appear at the same time, this is when they need to refresh the Invalidate ();

How can achieve only refresh this control, rather than the entire dialog

CodePudding user response:

The GetParent () - & gt; GetDlgItem (btnID) - & gt; Invalidate ().

Had no effect for MAO wrote, not refresh?

The GetParent () - & gt; Invalidate ().

Only refresh the entire dialog so???????

CodePudding user response:

Invalidate the default parameter is true or false? Try to change parameters?

CodePudding user response:

SetWinbowText (after), control will redraw itself, does not need to Invalidate ();
If the window is invalid can use the Validate (); To make the window is valid

CodePudding user response:

Such as
{//SetFont () will InvalidateRect!!!!! Then the program be recurcive.
PWnd - & gt; The SetFont (& amp; M_objFntEdt);
PWnd - & gt; The ValidateRect (0);
}

CodePudding user response:

The GetParent () - & gt; Invalidate (). Can effective

The GetParent () - & gt; GetDlgItem (btnID) - & gt; Invalidate (). It didn't meet the expected targets refresh btnID controls


So I think that has nothing to do with default parameters

CodePudding user response:

And like a
//do not draw all Ctls!
If # 1//if 0, see "To Do"
The CWnd * pWnd=GetTopWindow ();//the child window
While (pWnd!=NULL)
{
//afxDump & lt; & lt; PWnd - & gt; GetDlgCtrlID () & lt; & lt; "\ n";
//1005 1000 1001 1002 1003 1004 1006 1007 1010 1011 1008 1009 1012
//1005=IDC_STATIC1 TabOrder=1
PWnd - & gt; GetClientRect (& amp; Rc);
PWnd - & gt; The ValidateRect (& amp; Rc);
PWnd=pWnd - & gt; GetNextWindow ();
}
# endif

CodePudding user response:

I this is, for example, I have other place need refresh the specified control that defines a two dimensional array, for example, clicking on a button, ID, according to the button text is changed; This time need to refresh, I should also refresh, there is a button image description is bad, not to mention

CodePudding user response:

And SetWinbowText (after), the original text is displayed in the dialog background

CodePudding user response:

A lot of problems are caused by custom painting!

CodePudding user response:

Try
(GetParent () - & gt; GetDlgItem (btnID)) - & gt; Invalidate ().

CodePudding user response:

Like the brackets cannot cross - & gt; ?

As (GetParent (), then an error

The GetParent () - & gt; GetDlgItem (btnID) - & gt; Invalidate (). Is this usage? I've tried many times, has always been not to take effect, do not know why
  • Related