Home > Software engineering >  How to give a constructor color variable initialization
How to give a constructor color variable initialization

Time:12-30

In the line. H, defines a private member variables Color
The class line
{
Private:
Color line_color;//color value
Int line_path;//track
Int line_width;//line width
Public:
Vector value;//curve values
The line (void);
~ the line (void);
The line (TCHAR * m_name, float m_min, float m_max, Color m_line_color, int m_line_path, int m_line_width);
Void Set_color (Color line_color);//set colors
}
In. CPP in the constructor initializes the following:
Void line: : Set_color (Color m_line_color)//set colors
{
This - & gt; Line_color=m_line_color;
//this - & gt; Line_color=(m_line_color m_line_color. Red, Green, m_line_color. Blue);
}
So write if you have any questions? I change Color object behind the line. The set_color (Color (0, 0)) how are not successful ~ ~

CodePudding user response:

1 note function call case
After 2 change colors to trigger a redraw can see effect, InvalidateRect RedrawWindow etc.

CodePudding user response:

reference 1st floor zgl7903 response:
1 note function call case
After 2 change colors to trigger a redraw to see results, InvalidateRect RedrawWindow etc.
all these should be no problem, I also changed the other had to be refreshed case also is not a problem ~ ~ I just want to know this function so write if you have any questions? Because I found the most began to write in to object color are not being replaced,
Void line: : Set_color (Color m_line_color)//set colors
{
This - & gt; Line_color=m_line_color;
//this - & gt; Line_color=(m_line_color m_line_color. Red, Green, m_line_color. Blue);
}

CodePudding user response:

To set breakpoints single-step debugging see

CodePudding user response:

What do you mean you don't succeed? Set the color, to update the window to see the effect, for example, call invalidate ()
  • Related