2121using System . Drawing ;
2222using System . Windows . Forms ;
2323using ORTS . Updater ;
24- using static System . Net . Mime . MediaTypeNames ;
25- using static System . Windows . Forms . VisualStyles . VisualStyleElement ;
2624using Button = System . Windows . Forms . Button ;
2725using Image = System . Drawing . Image ;
2826
@@ -37,22 +35,22 @@ public class NotificationPage
3735 public List < Control > ControlList = new List < Control > ( ) ;
3836
3937 public NotificationPage ( MainForm mainForm , Panel panel , Image nextImage , Image previousImage , Image firstImage , Image lastImage , string pageCount ,
40- bool previousVisible , bool firstVisible , bool nextVisible , bool lastVisible )
38+ bool previousVisible , bool firstVisible , bool nextVisible , bool lastVisible )
4139 {
4240 MainForm = mainForm ;
4341 Panel = panel ;
4442 NButtonControl . ButtonCount = 0 ;
4543
46- var nextPageControl = AddArrow ( panel , nextImage , nextVisible , true , 25 ) ;
44+ var nextPageControl = new Arrow ( panel , nextImage , nextVisible , true , 25 ) ;
4745 nextPageControl . Click += new EventHandler ( MainForm . Next_Click ) ;
4846 Panel . Controls . Add ( nextPageControl ) ;
4947
50- var previousPageControl = AddArrow ( panel , previousImage , previousVisible , true , 90 ) ;
48+ var previousPageControl = new Arrow ( panel , previousImage , previousVisible , true , 90 ) ;
5149 previousPageControl . Click += new EventHandler ( MainForm . Previous_Click ) ;
5250 Panel . Controls . Add ( previousPageControl ) ;
5351
54- Panel . Controls . Add ( AddArrow ( panel , lastImage , lastVisible , false , 25 ) ) ;
55- Panel . Controls . Add ( AddArrow ( panel , firstImage , firstVisible , false , 90 ) ) ;
52+ Panel . Controls . Add ( new Arrow ( panel , lastImage , lastVisible , false , 25 ) ) ;
53+ Panel . Controls . Add ( new Arrow ( panel , firstImage , firstVisible , false , 90 ) ) ;
5654
5755 var pageCountControl = new Label
5856 {
@@ -67,19 +65,22 @@ public NotificationPage(MainForm mainForm, Panel panel, Image nextImage, Image p
6765 Panel . Controls . Add ( pageCountControl ) ;
6866 }
6967
70- private Button AddArrow ( Panel panel , Image image , bool visible , bool enabled , int indentRight )
71- {
72- var button = new Button { Margin = new Padding ( 0 ) , Text = "" , FlatStyle = FlatStyle . Flat } ;
73- button . Left = panel . ClientSize . Width - indentRight ;
74- button . Top = 0 ;
75- button . Width = 20 ;
76- button . Anchor = AnchorStyles . Top | AnchorStyles . Left ;
77- button . FlatAppearance . BorderSize = 0 ;
78- button . BackgroundImageLayout = ImageLayout . Center ;
79- button . BackgroundImage = image ;
80- button . Visible = visible ;
81- button . Enabled = enabled ;
82- return button ;
68+ public class Arrow : Button {
69+ public Arrow ( Panel panel , Image image , bool visible , bool enabled , int indentRight )
70+ {
71+ Margin = new Padding ( 0 ) ;
72+ Text = "" ;
73+ FlatStyle = FlatStyle . Flat ;
74+ Left = panel . ClientSize . Width - indentRight ;
75+ Top = 0 ;
76+ Width = 20 ;
77+ Anchor = AnchorStyles . Top | AnchorStyles . Left ;
78+ FlatAppearance . BorderSize = 0 ;
79+ BackgroundImageLayout = ImageLayout . Center ;
80+ BackgroundImage = image ;
81+ Visible = visible ;
82+ Enabled = enabled ;
83+ }
8384 }
8485
8586 public class NDetail
0 commit comments