📄 control.h
字号:
Its value can be retrieved with the GetModify member function.
SeeAlso:
none.
*/
void SetModify(BOOL bModified = TRUE);
/**
Sets the current default character formatting attributes in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
CHARFORMAT cf;
cf.dwEffects = CFE_BOLD;
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
richEdit.SetDefaultCharFormat(cf);
CHARFORMAT cfResult;
richEdit.GetDefaultCharFormat(cfResult);
ASSERT((cfResult.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) == (CFM_STRIKEOUT|CFM_BOLD));
ASSERT((cfResult.dwEffects & (CFE_STRIKEOUT|CFE_BOLD) ) == CFE_BOLD);
Parameters:
cf = CHARFORMAT structure containing the new default character formatting attributes.
Return:
Nonzero if successful; otherwise, 0.
Remarks:
Call this function to set the character formatting attributes for new text
in this RichEdit control. Only the attributes specified by the dwMask member
of cf are changed by this function.
SeeAlso:
RichEdit::GetDefaultCharFormat
*/
BOOL SetDefaultCharFormat(CHARFORMAT& cf);
/**
Retrieves the character formatting attributes in the
current selection in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
CHARFORMAT cf;
cf.dwEffects = CFE_BOLD;
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
richEdit.SetSelectionCharFormat(cf);
CHARFORMAT cfResult;
richEdit.GetSelectionCharFormat(cfResult);
ASSERT((cfResult.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) == (CFM_STRIKEOUT|CFM_BOLD));
ASSERT((cfResult.dwEffects & (CFE_STRIKEOUT|CFE_BOLD) ) == CFE_BOLD);
Parameters:
cf = Pointer to a CHARFORMAT structure to receive the character
formatting attributes of the current selection
Return:
The dwMask data member of cf. It specifies the character formatting attributes
that are consistent throughout the current selection.
Remarks
Call this function to get the character formatting attributes
of the current selection. The cf parameter receives the
attributes of the first character in the current selection.
The return value specifies which attributes are consistent
throughout the selection.
SeeAlso:
RichEdit::SetSelectionCharFormat
*/
DWORD GetSelectionCharFormat(CHARFORMAT& cf);
/**
Retrieves the current default character formatting attributes in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
CHARFORMAT cf;
cf.dwEffects = CFE_BOLD;
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
richEdit.SetDefaultCharFormat(cf);
CHARFORMAT cfResult;
richEdit.GetDefaultCharFormat(cfResult);
ASSERT((cfResult.dwMask&(CFM_STRIKEOUT|CFM_BOLD)) == (CFM_STRIKEOUT|CFM_BOLD));
ASSERT((cfResult.dwEffects & (CFE_STRIKEOUT|CFE_BOLD) ) == CFE_BOLD);
Parameters:
cf = Pointer to a CHARFORMAT structure which will hold the
default character formatting attributes.
Return:
The dwMask data member of cf. It specified the default
character formatting attributes.
SeeAlso:
RichEdit::SetDefaultCharFormat;
*/
DWORD GetDefaultCharFormat(CHARFORMAT& cf);
/**
Gets the starting and ending positions of the current selection in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
COLORREF cr = RGB(255, 0, 0);
richEdit.SetTextColor(0, 100, cr);
Parameters:
nStartChar = Zero-based index of the first character in the current selection.
nEndChar = Zero-based index of the last character in the current selection.
cr = Specifies the color to to be used for seleted text.
Return:
Nonzero if successful; otherwise, 0.
Remarks:
Call this function to get the default character formatting
attributes of this RichEdit control.
SeeAlso:
none.
*/
BOOL SetTextColor(long nStartChar, long nEndChar, COLORREF cr);
/**
Get index of first character in a line
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int nBegin, nEnd;
// Replace the second line, if it exists, of the rich edit control
// with the text "Origin C".
if ((nBegin = richEdit.LineIndex(1)) != -1)
{
nEnd = nBegin + richEdit.LineLength(1);
richEdit.SetSel(nBegin, nEnd);
richEdit.ReplaceSel("Origin C");
}
Parameters:
nLine = Contains the index value for the desired line in
the text of the richedit control, or contains -1.
If nLine is -1, it specifies the current line, that is, the line that contains the caret.
Return:
The character index of the line specified in nLine or -1
if the specified line number is greater then the number
of lines in the edit control.
Remarks:
Call this function to retrieve the character index of a
line within a multiple-line edit control. The character index
is the number of characters from the beginning of the edit
control to the specified line.
*/
int LineIndex( int nLine = -1 ) const;
/**
Get line number from character index
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
// The index of the char to get information on.
int nIndex = 10;
long nLine = richEdit.LineFromChar(nIndex);
Parameters:
nIndex = the zero-based index value for the desired character
in the text of the edit control, or contains -1.
If nIndex is -1, it specifies the current line, that is,
the line that contains the caret.
Return:
The zero-based line number of the line containing the character
index specified by nIndex. If nIndex is -1, the number of the
line that contains the first character of the selection is returned.
If there is no selection, the current line number is returned.
Remarks:
Call this function to retrieve the line number of the line that contains
the specified character index. A character index is the number of characters
from the beginning of the rich edit control.
*/
long LineFromChar( long nIndex = -1) const;
/**
Get the line of text at specified line index
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int ii, nLineLength;
int nLineCount = richEdit.GetLineCount();
string strText;
for (ii = 0; ii < nLineCount; ii++)
{
nLineLength = richEdit.LineLength(ii);
strText = richEdit.GetLine(ii);
}
Parameters:
nIndex = the zero-based index value for the desired character
in the text of the edit control, or contains -1. If nIndex is -1,
it specifies the current line, that is, the line that contains the caret.
Return:
the text at given line or an empty string is line specified is not a valid line number
Remarks:
The implementation of this function is different from the MFC version.
The MFC version is more difficult to use.
*/
string GetLine( int nIndex = -1) const;
/**
Retrieves the length of a given line in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int ii, nLineLength;
int nLineCount = richEdit.GetLineCount();
string strText;
for (ii = 0; ii < nLineCount; ii++)
{
nLineLength = richEdit.LineLength(ii);
strText = richEdit.GetLine(ii);
}
Parameters
nLine = Specifies the character index of a character in the line whose
length is to be retrieved. If this parameter is -1, the length of the
current line (the line that contains the caret) is returned,
not including the length of any selected text within the line.
When LineLength is called for a single-line edit control,
this parameter is ignored.
Return:
When LineLength is called for a multiple-line edit control,
the return value is the length (in bytes) of the line specified by nLine.
When LineLength is called for a single-line edit control,
the return value is the length (in bytes) of the text in the edit control.
Remarks
Call this function to retrieve the length of a line in a RichEdit control.
*/
int LineLength( int nLine = -1 ) const;
/**
Retrieves the number of lines in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int ii, nLineLength;
int nLineCount = richEdit.GetLineCount();
string strText;
for (ii = 0; ii < nLineCount; ii++)
{
nLineLength = richEdit.LineLength(ii);
strText = richEdit.GetLine(ii);
}
Parameters:
None.
Return:
The number of lines in this richedit control.
Remarks
Call this function to retrieve the number of lines in the RichEdit control.
*/
int GetLineCount( ) const;
/**
Scrolls the text in this RichEdit control.
Example:
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int nFirstVisible = richEdit.GetFirstVisibleLine();
// Scroll the rich edit control so that the first visible line is the first line of text.
if (nFirstVisible > 0)
richEdit.LineScroll(-nFirstVisible, 0);
Parameters:
nLines = Specifies the number of lines to scroll vertically.
nChars = Specifies the number of character positions to scroll horizontally.
This value is ignored if the rich edit control has either the ES_RIGHT or ES_CENTER style.
Return:
Zero-based index of the uppermost visible line in this RichEdit control.
Remarks
Call this function to scroll the text of a multiple-line edit control.
The edit control does not scroll vertically past the last line of text
in the edit control. If the current line plus the number of lines specified
by nLines exceeds the total number of lines in the edit control,
the value is adjusted so that the last line of the edit control
is scrolled to the top of the edit-control window.
LineScroll can be used to scroll horizontally past the last character of any line.
*/
void LineScroll( int nLines, int nChars = 0 );
/**
Limits the amount of text a user can enter into the RichEdit control.
Example:
#define TEXT_LIMITS 4096
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int nChars = TEXT_LIMITS;
richEdit.LimitText(nChars);
int nLimits = richEdit.GetLimitText();
ASSERT(TEXT_LIMITS == nLimits);
Return:
None.
Parameters:
nChars = Specifies the length (in bytes) of the text that the user can enter.
If this parameter is 0, the text length is set to UINT_MAX bytes. This is the default behavior.
Remarks
Call this function to limit the length of the text that the user can enter into an edit control.
Changing the text limit restricts only the text the user can enter. It has no effect on any
text already in the edit control, nor does it affect the length of the text copied to the edit
control by the Text member function in Window. If an application uses the Text
function to place more text into an edit control than is specified in the call to LimitText,
the user can delete any of the text within the edit control. However, the text limit will
prevent the user from replacing the existing text with new text, unless deleting the
current selection causes the text to fall below the text limit.
*/
void LimitText( long nChars = 0 );
/**
Gets the limit on the amount of text a user can enter into this RichEdit control.
Example:
#define TEXT_LIMITS 4096
RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
int nChars = TEXT_LIMITS;
richEdit.LimitText(nChars);
int nLimits = richEdit.GetLimitText();
ASSERT(TEXT_LIMITS == nLimits);
Return:
The current text limit, in bytes, for this RichEdit control.
Parameters:
None.
Remarks
Call this member function to get the text limit for this RichEdit control.
The text limit is the maximum amount of text, in bytes, the rich edit control can accept.
*/
long GetLimitText( ) const;
};
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class Slider : public Control
{
public:
/**
Example:
Slider slider = MyDlg.GetItem(IDC_SLIDER1);
Slider m_slider(slider);
*/
Slider();
/**
*/
Slider(Control& ctrl);
/**
Example:
Slider m_slider = MyDlg.GetItem(IDC_SLIDER1);
m_slider.Position = m_slider.RangeMax;
int nPos = m_slider.Position;
*/
int Position;
/**
Example:
Slider m_slider = MyDlg.GetItem(IDC_SLIDER1);
int nMax = m_slider.RangeMax;
*/
int RangeMax;
/**
Example:
Slider m_slider = MyDlg.GetItem(IDC_SLIDER1);
int nMin = m_slider.RangeMin;
*/
int RangeMin;
/**
Example:
Slider m_slider = MyDlg.GetItem(IDC_SLIDER1);
int nFreq = 3;
m_slider.SetTicFreq(nFreq);
*/
void SetTicFreq(int freq);
};
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class GraphControl : public Control
{
public:
/**
*/
GraphControl();
/**
*/
GraphControl(Control& ctrl);
/**
Example:
*/
GraphPage GetPage();
/**
Create the Origin Graph inside the control window
Parameters:
dwNoClickBits = options to diable clicking on various components on a graph
lpcszTemplateName = template name. If no path is specified, will assume the Origin path. NULL will use Origin.otp.
Return:
TRUE for success.
Example:
static BOOL OnInitDialog()
{
OriginGraph og1 = GraphDlg.GetItem(IDC_TWOGRAPHS_GRAPH1);
// must create Origin graph
og1.Create(NOCLICK_AXES | NOCLICK_TICKLABEL | NOCLICK_LAYERICON);
return TRUE;
}
Remarks:
You must create an Origin graph. Typically this is done in the OnInitDialog function.
*/
BOOL Create(DWORD dwNoClickBits = NOCLICK_USE_DEFAULT, LPCSTR lpcszTemplateName=NULL);
};
/** >User Interface Controls
This class is only available to OriginPro users.
Example:
*/
class WorksheetControl : public Control
{
public:
/**
*/
WorksheetControl();
/**
*/
WorksheetControl(Control& ctrl);
/**
Attach a worksheet to this control
Parameters:
lpcszWorksheetName = worksheet name.
Return:
TRUE for success.
Example:
WorksheetControl wc = dlg.GetItem(IDC_WORKSHEET);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -