tangxu
2024-10-24 3024f6d3d1618d8e90082f5aec0cc1bb6fabeea6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using Microsoft.Drawing;
 
namespace Microsoft.Windows.Forms
{
    public partial class Sprite
    {
        //当前状态的背景色
        private Color? m_CurrentBackColor;
        /// <summary>
        /// 当前状态的背景色
        /// </summary>
        internal Color CurrentBackColor
        {
            get
            {
                if (this.m_CurrentBackColor == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentBackColor = this.m_BackColor;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentBackColor = this.m_BackColorHovered;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentBackColor = this.m_BackColorPressed;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentBackColor = this.m_BackColorFocused;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentBackColor = this.m_BackColorDisabled;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentBackColor = Color.Empty;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentBackColor = this.m_BackColorHighlight;
                            break;
 
                        default:
                            this.m_CurrentBackColor = this.m_BackColor;
                            break;
                    }
                }
                return this.m_CurrentBackColor.Value;
            }
        }
 
        //背景色是否反向绘制
        private bool? m_CurrentBackColorReverse;
        /// <summary>
        /// 背景色是否反向绘制
        /// </summary>
        internal bool CurrentBackColorReverse
        {
            get
            {
                if (this.m_CurrentBackColorReverse == null)
                {
                    this.m_CurrentBackColorReverse = (this.m_BackColorAlign == TabAlignment.Right || this.m_BackColorAlign == TabAlignment.Bottom);
                }
                return this.m_CurrentBackColorReverse.Value;
            }
        }
 
        //背景色渐变模式
        private LinearGradientMode? m_CurrentBackColorMode;
        /// <summary>
        /// 背景色渐变模式
        /// </summary>
        internal LinearGradientMode CurrentBackColorMode
        {
            get
            {
                if (this.m_CurrentBackColorMode == null)
                {
                    this.m_CurrentBackColorMode = (this.m_BackColorAlign == TabAlignment.Left || this.m_BackColorAlign == TabAlignment.Right) ? LinearGradientMode.Horizontal : LinearGradientMode.Vertical;
                }
                return this.m_CurrentBackColorMode.Value;
            }
        }
 
        //背景色限制区域的矩形
        private Rectangle? m_CurrentBackColorPathRect;
        /// <summary>
        /// 背景色限制区域的矩形
        /// </summary>
        internal Rectangle CurrentBackColorPathRect
        {
            get
            {
                if (this.m_CurrentBackColorPathRect == null)
                {
                    Rectangle rect = this.m_BackColorRect;
                    //左侧
                    if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Left) != 0)
                    {
                        rect.X += 2;
                        rect.Width -= 2;
                    }
                    else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Left) != 0)
                    {
                        rect.X += 1;
                        rect.Width -= 1;
                    }
 
                    //上边
                    if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Top) != 0)
                    {
                        rect.Y += 2;
                        rect.Height -= 2;
                    }
                    else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Top) != 0)
                    {
                        rect.Y += 1;
                        rect.Height -= 1;
                    }
 
                    //右边
                    if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Right) != 0)
                    {
                        rect.Width -= 2;
                    }
                    else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Right) != 0)
                    {
                        rect.Width -= 1;
                    }
 
                    //下边
                    if ((this.m_InnerBorderVisibleStyle & BorderVisibleStyle.Bottom) != 0)
                    {
                        rect.Height -= 2;
                    }
                    else if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Bottom) != 0)
                    {
                        rect.Height -= 1;
                    }
                    RectangleEx.MakeNotEmpty(ref rect);
                    this.m_CurrentBackColorPathRect = rect;
                    this.m_Graphics.SetClip(this.m_CurrentBackColorPathRect.Value, CombineMode.Intersect);//设置剪切区
                }
                return this.m_CurrentBackColorPathRect.Value;
            }
        }
 
        //背景色限制区域的矩形(要Fill的Path)
        private GraphicsPath m_CurrentBackColorPath;
        /// <summary>
        /// 背景色限制区域的矩形(要Fill的Path)
        /// </summary>
        internal GraphicsPath CurrentBackColorPath
        {
            get
            {
                if (this.IsDisposed)
                    throw new ObjectDisposedException(base.GetType().ToString());
 
                if (this.m_CurrentBackColorPath == null)
                {
                    this.m_CurrentBackColorPath = RenderEngine.CreateGraphicsPath(this.CurrentBackColorPathRect, this.m_RoundCornerStyle, this.m_RoundStyle, this.m_RoundRadius, false);
                }
                return this.m_CurrentBackColorPath;
            }
        }
 
        //背景色画刷矩形
        private Rectangle? m_CurrentBackColorBrushRect;
        /// <summary>
        /// 背景色画刷矩形
        /// </summary>
        internal Rectangle CurrentBackColorBrushRect
        {
            get
            {
                if (this.m_CurrentBackColorBrushRect == null)
                {
                    Rectangle rect = RectangleEx.Inflate(this.CurrentBackColorPathRect, this.m_BackColorAlign, 1, 1);
                    RectangleEx.MakeNotEmpty(ref rect);
                    this.m_CurrentBackColorBrushRect = rect;
                }
                return this.m_CurrentBackColorBrushRect.Value;
            }
        }
 
 
        //当前背景图
        private Image m_CurrentBackgroundImage;
        /// <summary>
        /// 当前背景图
        /// </summary>
        internal Image CurrentBackgroundImage
        {
            get
            {
                if (this.m_CurrentBackgroundImage == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImage;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImageHovered ?? this.m_BackgroundImage;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImagePressed ?? this.m_BackgroundImage;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImageFocused ?? this.m_BackgroundImage;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImageDisabled ?? this.m_BackgroundImage;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentBackgroundImage = null;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImageHighlight ?? this.m_BackgroundImage;
                            break;
 
                        default:
                            this.m_CurrentBackgroundImage = this.m_BackgroundImage;
                            break;
                    }
                }
                return this.m_CurrentBackgroundImage;
            }
        }
 
        //背景图绘制矩形
        private Rectangle? m_CurrentBackgroundImageRect;
        /// <summary>
        /// 背景图绘制矩形
        /// </summary>
        internal Rectangle CurrentBackgroundImageRect
        {
            get
            {
                if (this.m_CurrentBackgroundImageRect == null)
                {
                    Rectangle rect = this.m_BackgroundImageRect;
                    RectangleEx.MakeNotEmpty(ref rect);
                    this.m_CurrentBackgroundImageRect = rect;
                }
                return this.m_CurrentBackgroundImageRect.Value;
            }
        }
 
 
        //当前九宫格背景图
        private Image m_CurrentBackgroundImage9;
        /// <summary>
        /// 当前九宫格背景图
        /// </summary>
        internal Image CurrentBackgroundImage9
        {
            get
            {
                if (this.m_CurrentBackgroundImage9 == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9Hovered ?? this.m_BackgroundImage9;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9Pressed ?? this.m_BackgroundImage9;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9Focused ?? this.m_BackgroundImage9;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9Disabled ?? this.m_BackgroundImage9;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentBackgroundImage9 = null;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9Highlight ?? this.m_BackgroundImage9;
                            break;
 
                        default:
                            this.m_CurrentBackgroundImage9 = this.m_BackgroundImage9;
                            break;
                    }
                }
                return this.m_CurrentBackgroundImage9;
            }
        }
 
        //九宫格背景图绘制矩形
        private Rectangle? m_CurrentBackgroundImage9Rect;
        /// <summary>
        /// 九宫格背景图绘制矩形
        /// </summary>
        internal Rectangle CurrentBackgroundImage9Rect
        {
            get
            {
                if (this.m_CurrentBackgroundImage9Rect == null)
                {
                    Rectangle rect = this.m_BackgroundImage9Rect;
                    RectangleEx.MakeNotEmpty(ref rect);
                    this.m_CurrentBackgroundImage9Rect = rect;
                }
                return this.m_CurrentBackgroundImage9Rect.Value;
            }
        }
 
 
        //当前边框颜色
        private Color? m_CurrentBorderColor;
        /// <summary>
        /// 当前边框颜色
        /// </summary>
        internal Color CurrentBorderColor
        {
            get
            {
                if (this.m_CurrentBorderColor == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentBorderColor = this.m_BorderColor;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentBorderColor = this.m_BorderColorHovered;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentBorderColor = this.m_BorderColorPressed;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentBorderColor = this.m_BorderColorFocused;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentBorderColor = this.m_BorderColorDisabled;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentBorderColor = Color.Empty;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentBorderColor = this.m_BorderColorHighlight;
                            break;
 
                        default:
                            this.m_CurrentBorderColor = this.m_BorderColor;
                            break;
                    }
                }
                return this.m_CurrentBorderColor.Value;
            }
        }
 
        //边框路径矩形
        private Rectangle? m_CurrentBorderPathRect;
        /// <summary>
        /// 边框路径矩形
        /// </summary>
        internal Rectangle CurrentBorderPathRect
        {
            get
            {
                if (this.m_CurrentBorderPathRect == null)
                {
                    Rectangle rect = this.m_BorderColorRect;
                    rect.Width--;
                    rect.Height--;
                    this.m_CurrentBorderPathRect = rect;
                }
                return this.m_CurrentBorderPathRect.Value;
            }
        }
 
        //边框画刷矩形
        private Rectangle? m_CurrentBorderBrushRect;
        /// <summary>
        /// 边框画刷矩形
        /// </summary>
        internal Rectangle CurrentBorderBrushRect
        {
            get
            {
                if (this.m_CurrentBorderBrushRect == null)
                {
                    this.m_CurrentBorderBrushRect = RectangleEx.Inflate(this.CurrentBorderPathRect, this.m_BackColorAlign, 1, 1);
                }
                return this.m_CurrentBorderBrushRect.Value;
            }
        }
 
        //当前内边框颜色
        private Color? m_CurrentInnerBorderColor;
        /// <summary>
        /// 当前内边框颜色
        /// </summary>
        internal Color CurrentInnerBorderColor
        {
            get
            {
                if (this.m_CurrentInnerBorderColor == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColor;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColorHovered;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColorPressed;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColorFocused;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColorDisabled;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentInnerBorderColor = Color.Empty;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColorHighlight;
                            break;
 
                        default:
                            this.m_CurrentInnerBorderColor = this.m_InnerBorderColor;
                            break;
                    }
                }
                return this.m_CurrentInnerBorderColor.Value;
            }
        }
 
        //内边框路径矩形
        private Rectangle? m_CurrentInnerBorderPathRect;
        /// <summary>
        /// 内边框路径矩形
        /// </summary>
        internal Rectangle CurrentInnerBorderPathRect
        {
            get
            {
                if (this.m_CurrentInnerBorderPathRect == null)
                {
                    Rectangle rect = this.CurrentBorderPathRect;
                    if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Left) != 0)
                    {
                        rect.X++;
                        rect.Width--;
                    }
                    if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Top) != 0)
                    {
                        rect.Y++;
                        rect.Height--;
                    }
                    if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Right) != 0)
                    {
                        rect.Width--;
                    }
                    if ((this.m_BorderVisibleStyle & BorderVisibleStyle.Bottom) != 0)
                    {
                        rect.Height--;
                    }
                    this.m_CurrentInnerBorderPathRect = rect;
                }
                return this.m_CurrentInnerBorderPathRect.Value;
            }
        }
 
        //内边框画刷矩形
        private Rectangle? m_CurrentInnerBorderBrushRect;
        /// <summary>
        /// 内边框画刷矩形
        /// </summary>
        internal Rectangle CurrentInnerBorderBrushRect
        {
            get
            {
                if (this.m_CurrentInnerBorderBrushRect == null)
                {
                    this.m_CurrentInnerBorderBrushRect = RectangleEx.Inflate(this.CurrentInnerBorderPathRect, this.m_BackColorAlign, 1, 1);
                }
                return this.m_CurrentInnerBorderBrushRect.Value;
            }
        }
 
 
        //字符串绘制区域矩形,传递进来的值
        private Rectangle? m_CurrentStringClientRect;
        /// <summary>
        /// 字符串绘制区域矩形,传递进来的值
        /// </summary>
        internal Rectangle CurrentStringClientRect
        {
            get
            {
                if (this.m_CurrentStringClientRect == null)
                {
                    this.m_CurrentStringClientRect = this.m_StringRect;
                }
                return this.m_CurrentStringClientRect.Value;
            }
        }
 
        //字符串实际绘制区域矩形,减去边距并偏移
        private Rectangle? m_CurrentStringRect;
        /// <summary>
        /// 字符串实际绘制区域矩形,减去边距并偏移
        /// </summary>
        internal Rectangle CurrentStringRect
        {
            get
            {
                if (this.m_CurrentStringRect == null)
                {
                    Rectangle rect = RectangleEx.Subtract(this.CurrentStringClientRect, this.m_Padding);
                    rect.Offset(this.m_TextOffset);
                    this.m_CurrentStringRect = rect;
                }
                return this.m_CurrentStringRect.Value;
            }
        }
 
        //字符串路径的矩形
        private Rectangle? m_CurrentStringPathRect;
        /// <summary>
        /// 字符串路径的矩形
        /// </summary>
        internal Rectangle CurrentStringPathRect
        {
            get
            {
                if (this.m_CurrentStringPathRect == null)
                {
                    return Rectangle.Empty;
                }
                return this.m_CurrentStringPathRect.Value;
            }
        }
 
        //字符串大小
        private Size? m_CurrentStringSize;
        /// <summary>
        /// 字符串大小
        /// </summary>
        internal Size CurrentStringSize
        {
            get
            {
                if (this.m_CurrentStringSize == null)
                {
                    return Size.Empty;
                }
                return this.m_CurrentStringSize.Value;
            }
        }
 
 
        //文本图片绘制区域矩形,传递进来的值
        private Rectangle? m_CurrentTextImageClientRect;
        /// <summary>
        /// 文本图片绘制区域矩形,传递进来的值
        /// </summary>
        internal Rectangle CurrentTextImageClientRect
        {
            get
            {
                if (this.m_CurrentTextImageClientRect == null)
                {
                    this.m_CurrentTextImageClientRect = this.m_TextImageRect;
                }
                return this.m_CurrentTextImageClientRect.Value;
            }
        }
 
        //可以容纳文本图片的矩形区域
        private Rectangle? m_CurrentTextImagePreferredRect;
        /// <summary>
        /// 可以容纳文本图片的矩形区域
        /// </summary>
        internal Rectangle CurrentTextImagePreferredRect
        {
            get
            {
                if (this.m_CurrentTextImagePreferredRect == null)
                {
                    Rectangle imageRect = this.CurrentImagePreferredRect;
                    Rectangle textRect = this.CurrentTextPreferredRect;
 
                    if (imageRect.Width == 0 || imageRect.Height == 0)
                        this.m_CurrentTextImagePreferredRect = textRect;
                    else if (textRect.Width == 0 || textRect.Height == 0)
                        this.m_CurrentTextImagePreferredRect = imageRect;
                    else
                        this.m_CurrentTextImagePreferredRect = Rectangle.Union(imageRect, textRect);
 
                }
                return this.m_CurrentTextImagePreferredRect.Value;
            }
        }
 
        //可以容纳文本的矩形区域
        private Rectangle? m_CurrentTextPreferredRect;
        /// <summary>
        /// 可以容纳文本的矩形区域
        /// </summary>
        internal Rectangle CurrentTextPreferredRect
        {
            get
            {
                if (this.m_CurrentTextPreferredRect == null)
                {
                    this.m_CurrentTextPreferredRect = Rectangle.Empty;
                }
                return this.m_CurrentTextPreferredRect.Value;
            }
 
            private set
            {
                switch (this.m_State)
                {
                    case State.Normal:
                        this.m_CurrentTextPreferredRect = value;
                        break;
 
                    case State.Hovered:
                    case State.HoveredFocused:
                        this.m_CurrentTextPreferredRect = RectangleEx.Offset(value, this.TextOffsetHovered);
                        break;
 
                    case State.Pressed:
                    case State.PressedFocused:
                        this.m_CurrentTextPreferredRect = RectangleEx.Offset(value, this.TextOffsetPressed);
                        break;
 
                    case State.NormalFocused:
                        this.m_CurrentTextPreferredRect = RectangleEx.Offset(value, this.TextOffsetFocused);
                        break;
 
                    case State.Disabled:
                        this.m_CurrentTextPreferredRect = RectangleEx.Offset(value, this.TextOffsetDisabled);
                        break;
 
                    case State.Hidden:
                        this.m_CurrentTextPreferredRect = value;
                        break;
 
                    case State.Highlight:
                        this.m_CurrentTextPreferredRect = RectangleEx.Offset(value, this.TextOffsetHighlight);
                        break;
 
                    default:
                        this.m_CurrentTextPreferredRect = value;
                        break;
                }
            }
        }
 
        //当前前景色
        private Color? m_CurrentForeColor;
        /// <summary>
        /// 当前前景色
        /// </summary>
        internal Color CurrentForeColor
        {
            get
            {
                if (this.m_CurrentForeColor == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentForeColor = this.m_ForeColor;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentForeColor = this.m_ForeColorHovered;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentForeColor = this.m_ForeColorPressed;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentForeColor = this.m_ForeColorFocused;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentForeColor = (this.m_TextGrayOnDisabled ? RenderEngine.GetGrayColor(this.CurrentBackColor) : this.m_ForeColorDisabled);
                            break;
 
                        case State.Hidden:
                            this.m_CurrentForeColor = Color.Empty;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentForeColor = this.m_ForeColorHighlight;
                            break;
 
                        default:
                            this.m_CurrentForeColor = this.m_ForeColor;
                            break;
                    }
                }
                return this.m_CurrentForeColor.Value;
            }
        }
 
        //可以容纳图片的矩形区域
        private Rectangle? m_CurrentImagePreferredRect;
        /// <summary>
        /// 可以容纳图片的矩形区域
        /// </summary>
        internal Rectangle CurrentImagePreferredRect
        {
            get
            {
                if (this.m_CurrentImagePreferredRect == null)
                {
                    this.m_CurrentImagePreferredRect = Rectangle.Empty;
                }
                return this.m_CurrentImagePreferredRect.Value;
            }
 
            private set
            {
 
                switch (this.m_State)
                {
                    case State.Normal:
                        this.m_CurrentImagePreferredRect = value;
                        break;
 
                    case State.Hovered:
                    case State.HoveredFocused:
                        this.m_CurrentImagePreferredRect = RectangleEx.Offset(value, this.ImageOffsetHovered);
                        break;
 
                    case State.Pressed:
                    case State.PressedFocused:
                        this.m_CurrentImagePreferredRect = RectangleEx.Offset(value, this.ImageOffsetPressed);
                        break;
 
                    case State.NormalFocused:
                        this.m_CurrentImagePreferredRect = RectangleEx.Offset(value, this.ImageOffsetFocused);
                        break;
 
                    case State.Disabled:
                        this.m_CurrentImagePreferredRect = RectangleEx.Offset(value, this.ImageOffsetDisabled);
                        break;
 
                    case State.Hidden:
                        this.m_CurrentImagePreferredRect = value;
                        break;
 
                    case State.Highlight:
                        this.m_CurrentImagePreferredRect = RectangleEx.Offset(value, this.ImageOffsetHighlight);
                        break;
 
                    default:
                        this.m_CurrentImagePreferredRect = value;
                        break;
                }
            }
        }
 
        //当前图片
        private Image m_CurrentImage;
        /// <summary>
        /// 当前图片
        /// </summary>
        internal Image CurrentImage
        {
            get
            {
                if (this.m_CurrentImage == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentImage = this.m_Image;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentImage = this.m_ImageHovered ?? this.m_Image;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentImage = this.m_ImagePressed ?? this.m_Image;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentImage = this.m_ImageFocused ?? this.m_Image;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentImage = this.m_ImageDisabled ?? this.m_Image;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentImage = null;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentImage = this.m_ImageHighlight ?? this.m_Image;
                            break;
 
                        default:
                            this.m_CurrentImage = this.m_Image;
                            break;
                    }
                }
                return this.m_CurrentImage;
            }
        }
 
 
        //当前直线颜色
        private Color? m_CurrentLineColor;
        /// <summary>
        /// 当前直线颜色
        /// </summary>
        internal Color CurrentLineColor
        {
            get
            {
                if (this.m_CurrentLineColor == null)
                {
                    switch (this.m_State)
                    {
                        case State.Normal:
                            this.m_CurrentLineColor = this.m_LineColor;
                            break;
 
                        case State.Hovered:
                        case State.HoveredFocused:
                            this.m_CurrentLineColor = this.m_LineColorHovered;
                            break;
 
                        case State.Pressed:
                        case State.PressedFocused:
                            this.m_CurrentLineColor = this.m_LineColorPressed;
                            break;
 
                        case State.NormalFocused:
                            this.m_CurrentLineColor = this.m_LineColorFocused;
                            break;
 
                        case State.Disabled:
                            this.m_CurrentLineColor = this.m_LineColorDisabled;
                            break;
 
                        case State.Hidden:
                            this.m_CurrentLineColor = Color.Empty;
                            break;
 
                        case State.Highlight:
                            this.m_CurrentLineColor = this.m_LineColorHighlight;
                            break;
 
                        default:
                            this.m_CurrentLineColor = this.m_LineColor;
                            break;
                    }
                }
                return this.m_CurrentLineColor.Value;
            }
        }
    }
}