Alexey_Gawrilow
Advanced Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору akaGM Без библиотек только олдскульно 1) Можно сделать по мотивам Код: begin PostMessage(Handle, WM_USER + 1024, 0, 0); MessageBox(Handle, 'message', 'caption', MB_OKCancel or MB_ICONQUESTION); end; | Код: {In forms-based units, we can set up a procedure to handle a specific message received by the form window. We needed to process the info in the dialog callback function in GENERIC.DPR...doing this in a form is considerably less confusing. Note the function declaration...I'd never seen a declaration like this before. I assume it predeclares Msg as WM_USER+1024, but how this actually triggers the procedure to execute is beyond me. Hey, this is Delphi...if it works, why delve deeper?} procedure pmChangeMessageBox ( var Msg: TMessage ); message WM_USER + 1024; | Код: procedure TForm1.pmChangeMessageBox ( var Msg: TMessage ); var MsgboxHwnd: HWND; Fonthandle:HFont; DlgFont:TLOGFONT; NewFont: HFont; NewIcon : THandle; begin {Now, when we fetch the messagebox windowhandle, we need to know its caption when using FindWindow. There's probably another way; I don't know it. The original author used FindWindow(MAKEINTRESOURCE(WC_DIALOG), 'caption') to insure that only dialog windows were polled by FindWindow, but when I tried FindWindow(nil,'My Message Caption') it worked just as well.} MsgboxHwnd := FindWindow(MAKEINTRESOURCE(WC_DIALOG), 'caption'); if (MsgboxHwnd <> 0) then begin {First let's mess with the button caption text.} SetDlgItemText( Msgboxhwnd, ID_OK {the ID number of the OK button}, 'Don''t press me' {the new button captio} ); {You could also modify the Cancel button text by specifying ID_CANCEL in another SetDlgItemText() command.} {Now let's modify a button font.} Fonthandle := SendMessage(MsgboxHwnd,WM_GETFONT,0,0); GetObject(Fonthandle,sizeof(TLOGFONT), @Dlgfont); strpcopy(Dlgfont.lfFaceName,'Times'); { You can also try messing with any other TLOGFONT characteristics.} { Dlgfont.lfClipPrecision := CLIP_LH_ANGLES or CLIP_TT_ALWAYS; Dlgfont.Lfweight := FW_BOLD; DlgFont.lfheight:= 25; Dlgfont.lfwidth:= 7;} NewFont := CreateFontIndirect(DlgFont); If NewFont <> 0 then SendDlgItemMessage(Msgboxhwnd,ID_OK,WM_SETFONT,NewFont,0); {Finally let's apply the application's icon to the messagebox. Delphi uses MAINICON as the default. You can specify other icons in your app's resources as well. The hard part of this was finding the messagebox item ID for the icon. I hacked a little test program together and discovered by trial-and- error that its ID is 10. (Sometimes you get lucky that way...it could have been 1024, and I was incrementing by 1's when inputting sequential item IDs.)} NewIcon := LoadIcon(hinstance,'MAINICON'); If Newicon <> 0 Then SendDlgItemMessage(Msgboxhwnd,10,STM_SETICON,NewIcon,0); {Now let's have a little fun with the caption. Check the OnTimer procedure to see how we did this.} TimerCount := 0; Timer1.Enabled := True; MBHWnd := MsgboxHwnd; end; end; | + Туда же перерисовку с кодами. Это если именно MessageBox. 2) Или по мотивам: https://www.rsdn.org/article/ui/custombox.xml Еще решение: hook для MessageBox и не забыть поддержать все возможные флаги и OS. Об этом и говорится выше(2). 3) Все уже придумано до нас: https://www.software4nonprofits.com/HtmlMessageBox/ Там же(https://www.software4nonprofits.com/HtmlMessageBox/whyMessageBox.htm) описаны и альтернативы. Не проверял. 4) HTML Parser + Painter + CustomForm Их Много, устанет рука, могу только ключевых слов накидать, где искать. _label: formatlabel lordtime.com names.DI names.FR names.jan names.sm part.9ray part.AlexanderAdam-IP part.DC part.ElDos part.Jedi part.OpenDiagramDesigner part.PCS part.QuickPDF part.RA part.TMS part.Berg QzHtmlLabel2 Real-Time Marquee Component.DELPHI AREA SimpleHtml.fe1ix Отображение текста с тегами форматирования hintbox.zip.txt HtHint.pas.txt raycrpanel.zip Simple HTML parsing and painting.txt VikButtonGroup.sv-utils.GoogleCode.zip vvmlabel.zip Вообще: Easynet WinINET Imp. & HTML DOM Parser CoolDev Html Tools 1.03b src Delphi Dom HTML Parser and Converter.sf DelphiHTMLParser HtmlViewer.BerndGabriel HtmlViewer.Keksov HtmlViewer.Synopse KeyNote.sf MarkupToken names.TurboPower part.is2sql part.LMD part.TMS part.clever.7z part.DataMaster2003.zip
---------- C уважением, Алексей. ----------------------------------------------- Хороших %s не бывает — бывает не худший вариант. |
|