extctrls/exquestiondlg: replace TImage and TLabel by directly drawn bitmap and text.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8154 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-11-23 17:17:28 +00:00
parent d95f7b808e
commit aad769d418
3 changed files with 359 additions and 235 deletions

View File

@@ -1,12 +1,12 @@
object DemoForm: TDemoForm
Left = 257
Height = 563
Height = 585
Top = 128
Width = 686
Width = 708
AutoSize = True
Caption = 'Test QuestionDlgEx'
ClientHeight = 563
ClientWidth = 686
ClientHeight = 585
ClientWidth = 708
OnCreate = FormCreate
LCLVersion = '2.3.0.0'
object rgButtons: TRadioGroup
@@ -16,9 +16,9 @@ object DemoForm: TDemoForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = rgMessage
AnchorSideBottom.Side = asrBottom
Left = 188
Height = 115
Top = 280
Left = 235
Height = 96
Top = 298
Width = 112
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
@@ -30,7 +30,7 @@ object DemoForm: TDemoForm
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 95
ClientHeight = 76
ClientWidth = 108
ItemIndex = 1
Items.Strings = (
@@ -43,15 +43,14 @@ object DemoForm: TDemoForm
end
object rgMessage: TRadioGroup
AnchorSideLeft.Control = gbTest
AnchorSideTop.Control = rgTextAlignment
AnchorSideTop.Control = gbTextAlignmentLayout
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = rgMsgType
AnchorSideRight.Control = gbTextAlignmentLayout
AnchorSideRight.Side = asrBottom
Left = 24
Height = 115
Top = 280
Width = 132
Anchors = [akTop, akLeft, akRight]
Height = 96
Top = 298
Width = 179
AutoFill = True
AutoSize = True
BorderSpacing.Top = 24
@@ -62,9 +61,10 @@ object DemoForm: TDemoForm
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 95
ClientWidth = 128
ChildSizing.ControlsPerLine = 2
ClientHeight = 76
ClientWidth = 175
Columns = 2
ItemIndex = 2
Items.Strings = (
'very short'
@@ -72,6 +72,8 @@ object DemoForm: TDemoForm
'medium'
'long'
'very long'
'high'
'long && linebreak'
)
TabOrder = 1
end
@@ -80,17 +82,17 @@ object DemoForm: TDemoForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = rgTextAlignment
AnchorSideBottom.Control = gbTextAlignmentLayout
AnchorSideBottom.Side = asrBottom
Left = 332
Height = 77
Left = 379
Height = 95
Top = 179
Width = 322
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 32
BorderSpacing.Right = 24
Caption = 'Font'
ClientHeight = 57
ClientHeight = 75
ClientWidth = 318
TabOrder = 2
object cbDefaultFont: TCheckBox
@@ -131,14 +133,14 @@ object DemoForm: TDemoForm
end
end
object rgBtnAlignment: TRadioGroup
AnchorSideLeft.Control = rgTextAlignment
AnchorSideLeft.Control = gbTextAlignmentLayout
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = rgTextAlignment
AnchorSideBottom.Control = gbTextAlignmentLayout
AnchorSideBottom.Side = asrBottom
Left = 188
Height = 77
Left = 235
Height = 95
Top = 179
Width = 112
Anchors = [akTop, akLeft, akBottom]
@@ -153,7 +155,7 @@ object DemoForm: TDemoForm
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 57
ClientHeight = 75
ClientWidth = 108
ItemIndex = 2
Items.Strings = (
@@ -163,37 +165,6 @@ object DemoForm: TDemoForm
)
TabOrder = 3
end
object rgTextAlignment: TRadioGroup
AnchorSideLeft.Control = gbTest
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = rgMsgType
AnchorSideRight.Side = asrBottom
Left = 24
Height = 77
Top = 179
Width = 132
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
Caption = 'Text alignment'
ChildSizing.LeftRightSpacing = 12
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 57
ClientWidth = 128
ItemIndex = 0
Items.Strings = (
'left'
'right'
'center'
)
TabOrder = 4
end
object gbMaxWidth: TGroupBox
AnchorSideLeft.Control = rgGlyphShowMode
AnchorSideLeft.Side = asrBottom
@@ -202,16 +173,16 @@ object DemoForm: TDemoForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = rgGlyphShowMode
AnchorSideBottom.Side = asrBottom
Left = 486
Height = 115
Top = 280
Left = 533
Height = 96
Top = 298
Width = 168
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 24
Caption = 'Dialog size limits'
ClientHeight = 95
ClientHeight = 76
ClientWidth = 164
TabOrder = 5
TabOrder = 4
object Label1: TLabel
AnchorSideLeft.Control = gbMaxWidth
AnchorSideTop.Control = seMaxWidth
@@ -224,15 +195,18 @@ object DemoForm: TDemoForm
Caption = 'Max width'
end
object seMaxWidth: TSpinEdit
AnchorSideLeft.Control = Label1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbMaxWidth
AnchorSideRight.Control = gbMaxWidth
AnchorSideRight.Side = asrBottom
Left = 90
Left = 88
Height = 23
Top = 12
Width = 58
Width = 60
Alignment = taRightJustify
Anchors = [akTop, akRight]
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 16
BorderSpacing.Top = 12
BorderSpacing.Right = 16
MaxValue = 10000
@@ -249,16 +223,17 @@ object DemoForm: TDemoForm
Caption = 'Min width'
end
object seMinWidth: TSpinEdit
AnchorSideLeft.Control = seMaxWidth
AnchorSideTop.Control = seMaxWidth
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbMaxWidth
AnchorSideRight.Side = asrBottom
Left = 90
Left = 88
Height = 23
Top = 51
Width = 58
Width = 60
Alignment = taRightJustify
Anchors = [akTop, akRight]
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 16
BorderSpacing.Right = 16
MaxValue = 10000
@@ -273,9 +248,9 @@ object DemoForm: TDemoForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = rgMsgType
AnchorSideBottom.Side = asrBottom
Left = 188
Left = 235
Height = 115
Top = 419
Top = 418
Width = 466
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
@@ -306,7 +281,7 @@ object DemoForm: TDemoForm
'poWorkAreaCenter'
'(Custom)'
)
TabOrder = 6
TabOrder = 5
object edX: TEdit
Left = 162
Height = 23
@@ -328,10 +303,13 @@ object DemoForm: TDemoForm
AnchorSideLeft.Control = gbTest
AnchorSideTop.Control = rgMessage
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbTextAlignmentLayout
AnchorSideRight.Side = asrBottom
Left = 24
Height = 115
Top = 419
Width = 132
Top = 418
Width = 179
Anchors = [akTop, akLeft, akRight]
AutoFill = True
AutoSize = True
BorderSpacing.Top = 24
@@ -345,7 +323,7 @@ object DemoForm: TDemoForm
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 95
ClientWidth = 128
ClientWidth = 175
ItemIndex = 0
Items.Strings = (
'mtWarning'
@@ -354,7 +332,7 @@ object DemoForm: TDemoForm
'mtConfirmation'
'mtCustom'
)
TabOrder = 7
TabOrder = 6
end
object rgGlyphShowMode: TRadioGroup
AnchorSideLeft.Control = gbFont
@@ -362,9 +340,9 @@ object DemoForm: TDemoForm
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = rgMessage
AnchorSideBottom.Side = asrBottom
Left = 332
Height = 115
Top = 280
Left = 379
Height = 96
Top = 298
Width = 130
Anchors = [akTop, akLeft, akBottom]
AutoFill = True
@@ -378,7 +356,7 @@ object DemoForm: TDemoForm
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 95
ClientHeight = 76
ClientWidth = 126
ItemIndex = 2
Items.Strings = (
@@ -387,7 +365,7 @@ object DemoForm: TDemoForm
'gsmApplication'
'gsmSystem '
)
TabOrder = 8
TabOrder = 7
end
object gbTest: TGroupBox
AnchorSideLeft.Control = Owner
@@ -402,7 +380,7 @@ object DemoForm: TDemoForm
Caption = 'Test QuestionDlgEx'
ClientHeight = 84
ClientWidth = 260
TabOrder = 9
TabOrder = 8
object btnQuestionDlgEx: TButton
AnchorSideLeft.Control = gbTest
AnchorSideTop.Control = gbTest
@@ -438,7 +416,7 @@ object DemoForm: TDemoForm
AnchorSideTop.Control = gbTest
AnchorSideRight.Control = gbFont
AnchorSideRight.Side = asrBottom
Left = 332
Left = 379
Height = 104
Top = 24
Width = 322
@@ -446,7 +424,7 @@ object DemoForm: TDemoForm
Caption = 'Test standard dialogs'
ClientHeight = 84
ClientWidth = 318
TabOrder = 10
TabOrder = 9
object btnQuestionDlg: TButton
AnchorSideTop.Control = gbTestStd
Left = 32
@@ -522,11 +500,143 @@ object DemoForm: TDemoForm
Left = 24
Height = 3
Top = 152
Width = 638
Width = 660
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 24
Shape = bsTopLine
end
object gbTextAlignmentLayout: TGroupBox
AnchorSideLeft.Control = gbTest
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = rgMessage
AnchorSideRight.Side = asrBottom
Left = 24
Height = 95
Top = 179
Width = 179
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Text alignment/layout'
ClientHeight = 75
ClientWidth = 175
TabOrder = 10
object Panel1: TPanel
AnchorSideLeft.Control = gbTextAlignmentLayout
AnchorSideTop.Control = gbTextAlignmentLayout
AnchorSideRight.Control = Bevel2
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = gbTextAlignmentLayout
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 69
Top = 0
Width = 72
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 6
BevelOuter = bvNone
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 69
ClientWidth = 72
TabOrder = 0
object rbLeftJustify: TRadioButton
Left = 0
Height = 19
Top = 0
Width = 63
Caption = 'left'
Checked = True
TabOrder = 2
TabStop = True
end
object rbHCenter: TRadioButton
Tag = 2
Left = 0
Height = 19
Top = 25
Width = 63
Caption = 'h-center'
TabOrder = 0
end
object rbRightJustify: TRadioButton
Tag = 1
Left = 0
Height = 19
Top = 50
Width = 63
Caption = 'right'
TabOrder = 1
end
end
object Panel2: TPanel
AnchorSideLeft.Control = Bevel2
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbTextAlignmentLayout
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = gbTextAlignmentLayout
AnchorSideBottom.Side = asrBottom
Left = 100
Height = 69
Top = 0
Width = 62
AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Right = 8
BorderSpacing.Bottom = 6
BevelOuter = bvNone
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 69
ClientWidth = 62
TabOrder = 1
object rbTop: TRadioButton
Left = 0
Height = 19
Top = 0
Width = 62
Caption = 'top'
TabOrder = 0
end
object rbVCenter: TRadioButton
Tag = 1
Left = 0
Height = 19
Top = 25
Width = 62
Caption = 'v-center'
Checked = True
TabOrder = 2
TabStop = True
end
object rbBottom: TRadioButton
Tag = 2
Left = 0
Height = 19
Top = 50
Width = 62
Caption = 'bottom'
TabOrder = 1
end
end
object Bevel2: TBevel
AnchorSideLeft.Control = gbTextAlignmentLayout
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Panel1
AnchorSideBottom.Control = Panel2
AnchorSideBottom.Side = asrBottom
Left = 86
Height = 69
Top = 0
Width = 2
Anchors = [akTop, akLeft, akBottom]
end
end
object FontDialog1: TFontDialog
MinFontSize = 0
MaxFontSize = 0

View File

@@ -14,6 +14,7 @@ type
TDemoForm = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
btnQuestionDlgEx: TButton;
btnQuestionDlg: TButton;
btnMessageDlg: TButton;
@@ -28,6 +29,15 @@ type
gbMaxWidth: TGroupBox;
gbTest: TGroupBox;
gbTestStd: TGroupBox;
Panel1: TPanel;
Panel2: TPanel;
rbLeftJustify: TRadioButton;
rbHCenter: TRadioButton;
rbRightJustify: TRadioButton;
rbTop: TRadioButton;
rbVCenter: TRadioButton;
rbBottom: TRadioButton;
gbTextAlignmentLayout: TGroupBox;
HTMLBrowserHelpViewer1: THTMLBrowserHelpViewer;
HTMLHelpDatabase1: THTMLHelpDatabase;
Label1: TLabel;
@@ -38,7 +48,6 @@ type
rgMsgType: TRadioGroup;
rgPosition: TRadioGroup;
rgBtnAlignment: TRadioGroup;
rgTextAlignment: TRadioGroup;
rgButtons: TRadioGroup;
rgMessage: TRadioGroup;
seMinWidth: TSpinEdit;
@@ -71,12 +80,14 @@ uses
const
DLG_TITLE = 'This is the caption of the dialog';
MSG_TEXT: array[0..4] of String = (
MSG_TEXT: array[0..6] of String = (
'msg',
'Short text',
'Text text text text text text text.',
'This is a long long long long text.',
'This is a very very very very very very very very very very very very very very long text.',
'This is even longer, another very very very very very very very very very very very very very very very very very very very very very very long text.'
'This is even longer, another very very very very very very very very very very very very very very very very very very very very very very long text.',
'Line 1' + LineEnding + 'Line 2' + LineEnding + 'Line 3' + LineEnding + 'Line 4' + LineEnding + 'Line 5',
'This is a long long long long text.' + LineEnding + 'Short text.' + 'This is a very very very very very very very very very very very very very very long text.'
);
@@ -86,7 +97,6 @@ procedure TDemoForm.btnQuestionDlgExClick(Sender: TObject);
var
msg: String;
X, Y: Integer;
// F: TForm;
mt: Dialogs.TMsgDlgType;
res: TModalResult;
begin
@@ -95,11 +105,16 @@ begin
QuestionDlgEx_MaxWidth := seMaxWidth.Value;
QuestionDlgEx_MinWidth := seMinWidth.Value;
QuestionDlgEx_ButtonAlignment := TAlignment(rgBtnAlignment.ItemIndex);
QuestionDlgEx_TextAlignment := TAlignment(rgTextAlignment.ItemIndex);
if rbLeftJustify.Checked then QuestionDlgEx_TextAlignment := taLeftJustify
else if rbRightJustify.Checked then QuestionDlgEx_TextAlignment := taRightJustify
else if rbHCenter.Checked then QuestionDlgEx_TextAlignment := taCenter;
if rbTop.Checked then QuestionDlgEx_TextLayout := tlTop
else if rbVCenter.Checked then QuestionDlgEx_TextLayout := tlCenter
else if rbBottom.Checked then QuestionDlgEx_TextLayout := tlBottom;
QuestionDlgEx_GlyphShowMode := TGlyphShowMode(rgGlyphShowMode.ItemIndex);
if cbDefaultFont.Checked then
begin
QuestionDlgEx_FontName := 'default';
QuestionDlgEx_FontName := '';
QuestionDlgEx_FontSize := 0;
end else
begin