@@ -32,6 +32,8 @@ internal class BrowserTabStrip : BaseStyledPanel, ISupportInitialize, IDisposabl
32
32
public int MaxTabSize = 200 ;
33
33
public int AddButtonWidth = 40 ;
34
34
35
+ private Point LastMousePos ;
36
+
35
37
[ RefreshProperties ( RefreshProperties . All ) ]
36
38
[ DefaultValue ( null ) ]
37
39
public BrowserTabPage SelectedTab {
@@ -299,20 +301,26 @@ private void CloseActiveTab() {
299
301
protected override void OnMouseMove ( MouseEventArgs e ) {
300
302
base . OnMouseMove ( e ) ;
301
303
304
+ LastMousePos = e . Location ;
305
+
302
306
// manually process events for buttons
303
307
closeButton . ProcessRolloverEvents ( this , e ) ;
304
308
newTabButton . ProcessRolloverEvents ( this , e ) ;
305
309
310
+ this . Invalidate ( ) ;
306
311
}
307
312
308
313
309
314
protected override void OnMouseLeave ( EventArgs e ) {
310
315
base . OnMouseLeave ( e ) ;
311
316
317
+ LastMousePos = Point . Empty ;
318
+
312
319
// manually process events for buttons
313
320
closeButton . ProcessRolloutEvents ( this ) ;
314
321
newTabButton . ProcessRolloutEvents ( this ) ;
315
322
323
+ this . Invalidate ( ) ;
316
324
}
317
325
318
326
protected override void OnSizeChanged ( EventArgs e ) {
@@ -423,8 +431,6 @@ private void DrawSingleTabButton(Graphics g, BrowserTabPage tab) {
423
431
424
432
RectangleF stripRect = tab . StripRect ;
425
433
var sr = stripRect ;
426
- SolidBrush brush = new SolidBrush ( ( tab == SelectedTab ) ? BrowserTabStyle . SelectedTabBackColor : BrowserTabStyle . NormalTabBackColor ) ;
427
- Pen pen = new Pen ( ( tab == SelectedTab ) ? BrowserTabStyle . TabBorderColor : BrowserTabStyle . NormalTabBackColor , BrowserTabStyle . TabBorderThickness ) ;
428
434
429
435
//--------------------------------------------------------
430
436
// Calc Rect for the Tab
@@ -445,6 +451,21 @@ private void DrawSingleTabButton(Graphics g, BrowserTabPage tab) {
445
451
//g.FillRoundRectangle(brush, tabDrawnRect,TabRadius);
446
452
//g.DrawRoundRectangle(SystemPens.ControlDark, tabDrawnRect, TabRadius);
447
453
454
+ //--------------------------------------------------------
455
+ // Style for the tab button
456
+ //--------------------------------------------------------
457
+ var tabColor = BrowserTabStyle . TabBackColor_Normal ;
458
+ var borderColor = BrowserTabStyle . TabBackColor_Normal ;
459
+ if ( tab == SelectedTab ) {
460
+ tabColor = BrowserTabStyle . TabBackColor_Selected ;
461
+ borderColor = BrowserTabStyle . TabBorderColor ;
462
+ }
463
+ else if ( tabDrawnRect . Contains ( LastMousePos ) ) {
464
+ tabColor = BrowserTabStyle . TabBackColor_Rollover ;
465
+ }
466
+ var brush = new SolidBrush ( tabColor ) ;
467
+ var pen = new Pen ( borderColor , BrowserTabStyle . TabBorderThickness ) ;
468
+
448
469
//--------------------------------------------------------
449
470
// Rounded Chrome Tabs
450
471
//--------------------------------------------------------
0 commit comments