Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.04.18;
Скачать: [xml.tar.bz2];

Вниз

RichEdit/RxRichEdit верхний/нижний индекс   Найти похожие ветки 

 
wa-ckum-gg   (2004-04-02 11:30) [0]

Здрассте. Мне нужно в компоненте RichEdit или RxRichEdit конкретный символ сделать надстрочным или подстрочным, т.е. сделать верхний или нижний индекс. Так уж получилось что нужно писать программу, связанную с химией. Помогите, пожалуйста, я в этих компонентах полный лам, не могу даже жирным сделать конкретный фргмент.


 
Defunct ©   (2004-04-02 11:41) [1]

RichEdit.SelStart
RichEdit.SelLength
RichEdit.SelAttributes
RichEdit.SelText


 
Developerr ©   (2004-04-02 11:47) [2]

А в библиотеке Rx есть готовый пример работы с RxRichEdit и там уже есть процедуры верхнего и нижнего индекса. Вот пример:

procedure TMainForm.SubscriptClick(Sender: TObject);
begin
 if FUpdating then Exit;
 if SuperscriptBtn.Down then
   CurrText.SubscriptStyle := ssSuperscript
 else if SubscriptBtn.Down then
   CurrText.SubscriptStyle := ssSubscript
 else
   CurrText.SubscriptStyle := ssNone;
end;


А дальше открой этот пример и посмотри весь код.


 
Anatoly Podgoretsky ©   (2004-04-02 11:47) [3]

И где там индексы?

Можно конечно с помошью копирования через буфер обмена, но это может быть не удобно


 
wa-ckum-gg   (2004-04-02 11:54) [4]

Там в примерах только три программы, одна для ДБ, другая для гифаниматора,а третья-просто Demo Program, где намёка на подобные строки нет. Где еще искать? И кстати, что такое CurrText?


 
Developerr ©   (2004-04-02 12:02) [5]

У меня есть и этот пример с RxRichEdit. А CurrText - это функция:

function TMainForm.CurrText: TRxTextAttributes;
begin
 if Editor.SelLength > 0 then Result := Editor.SelAttributes
 else Result := Editor.WordAttributes;
end;

Если хочешь, давай свой E-mail, я вышлю. Только почему-то он под Delphi 7 не запускается. Но процедуры работы с индексами работают. Лично поробовал.


> Anatoly Podgoretsky


> И где там индексы?

Пример открой и помотри.


 
Anatoly Podgoretsky ©   (2004-04-02 12:09) [6]

Открыл, нет,  приведи строчку из твоего примера по RichEdit.SelAttributes, может у меня старая справка.


 
wa-ckum-gg   (2004-04-02 12:12) [7]

wackum@bk.ru
вышли, пожалуйста


 
Developerr ©   (2004-04-02 12:17) [8]

SelAttributes is a TRxTextAttributes object, which specifies characteristics such as font face, color, size, style, and pitch.
pitch - высота.

Here are the possible values for SubscriptStyle:
• ssNone - characters are normal
• ssSubscript - characters are subscript.
• ssSuperscript - characters are superscript.

For both ssSubscript and ssSuperscript values, the control automatically calculates an offset and a smaller font size. Alternatively, you can use the Height and Offset properties to explicitly specify font size and offset for subscript and superscript characters.

Note
Requires Rich Edit 2.0 or later.

Superscript - надстрочный

Это все из справки.
Я в свое время писал курсовую по RxLibrary, так что изучил ее вдоль и поперек.


 
Developerr ©   (2004-04-02 12:23) [9]


> wa-ckum-gg  

Выслал. Лови.


 
Anatoly Podgoretsky ©   (2004-04-02 12:30) [10]

Developerr ©   (02.04.04 12:17) [8]
Так ты не про TRichEdit, а про посторонний компонент, ну посторонних много.


 
Developerr ©   (2004-04-02 12:35) [11]

Дык в вопросе спрашивалось

>  RichEdit/RxRichEdit верхний/нижний индекс


Вот я про него и говорю.


 
Serge ©   (2004-04-02 12:39) [12]

From MSDN

EM_SETCHARFORMAT
The EM_SETCHARFORMAT message sets character formatting in a rich edit control.

To send this message, call the SendMessage function with the following parameters.

SendMessage(
 (HWND) hWnd,              // handle to destination window
 EM_SETCHARFORMAT,         // message to send
 (WPARAM) wParam,          // formatting options
 (LPARAM) lParam          // char format (CHARFORMAT *)
);
Parameters
wParam
Character formatting that applies to the control. If this parameter is zero, the default character format is set. Otherwise, it can be one of the following values. Value Meaning
SCF_ALL Applies the formatting to all text in the control.
SCF_SELECTION Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion point, and the new character format is in effect only until the insertion point changes.
SCF_WORD | SCF_SELECTION Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the formatting is applied to the word. The SCF_WORD value must be used in conjunction with the SCF_SELECTION value.

lParam
Pointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by the dwMask member are changed.
Rich Edit 2.0 and later: This parameter can be a pointer to a CHARFORMAT2 structure, which is an extension of the CHARFORMAT structure. Before sending the EM_SETCHARFORMAT message, set the structure"s cbSize member to indicate the version of the structure.

The szFaceName and bCharSet may be overruled when invalid for characters, for example: Arial on kanji characters.

Return Values
If the operation succeeds, the return value is a nonzero value.

If the operation fails, the return value is zero.

Requirements
 Version: Requires Rich Edit 1.0 or later.
 Header: Declared in Richedit.h.

See Also
Rich Edit Controls Overview, Rich Edit Messages, CHARFORMAT, CHARFORMAT2

CHARFORMAT2
The CHARFORMAT2 structure contains information about character formatting in a rich edit control. CHARFORMAT2 is a Rich Edit 2.0 extension of the CHARFORMAT structure. Rich Edit 2.0 allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages.

typedef struct _charformat2 {
 UINT        cbSize;
 DWORD       dwMask;
 DWORD       dwEffects;
 LONG        yHeight;
 LONG        yOffset;
 COLORREF    crTextColor;
 BYTE        bCharSet;
 BYTE        bPitchAndFamily;
 TCHAR       szFaceName[LF_FACESIZE];
 WORD        wWeight;
 SHORT       sSpacing;
 COLORREF    crBackColor;
 LCID        lcid;
 DWORD       dwReserved;
 SHORT       sStyle;
 WORD        wKerning;
 BYTE        bUnderlineType;
 BYTE        bAnimation;
 BYTE        bRevAuthor;
 BYTE        bReserved1;
} CHARFORMAT2;



Страницы: 1 вся ветка

Форум: "Основная";
Текущий архив: 2004.04.18;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.49 MB
Время: 0.037 c
11-1063606563
savva
2003-09-15 10:16
2004.04.18
интересная работа функции Date2StrFmt


6-1076693078
Swimmer
2004-02-13 20:24
2004.04.18
Сканирование лок. сети и поиск программы-сервера по ней


8-1066990862
TRyaSS
2003-10-24 14:21
2004.04.18
3-d в Delphi(OpenGL , Direct X)


1-1080736572
AlexeyITN
2004-03-31 16:36
2004.04.18
Как перекрасить кнопку BitBtn переливающимся цветом?


1-1081002685
ss300
2004-04-03 18:31
2004.04.18
Install Shield





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский