@@ -30,72 +30,29 @@ namespace ORTS
3030{
3131 public class NotificationPage
3232 {
33-
34-
3533 public List < NDetail > NDetailList = new List < NDetail > ( ) ;
3634 public Dictionary < int , NButtonControl > ButtonDictionary = new Dictionary < int , NButtonControl > ( ) ;
3735 public Panel Panel ;
3836 private MainForm MainForm ; // Needed so the Retry button can raise an event which the form can catch.
3937 public List < Control > ControlList = new List < Control > ( ) ;
4038
4139 public NotificationPage ( MainForm mainForm , Panel panel , Image nextImage , Image previousImage , Image firstImage , Image lastImage , string pageCount ,
42- bool previousVisible , bool firstVisible , bool nextVisible , bool lastVisisble )
40+ bool previousVisible , bool firstVisible , bool nextVisible , bool lastVisible )
4341 {
4442 MainForm = mainForm ;
4543 Panel = panel ;
4644 NButtonControl . ButtonCount = 0 ;
4745
48- var nextPageControl = new Button { Margin = new Padding ( 0 ) , Text = "" , FlatStyle = FlatStyle . Flat } ;
49- nextPageControl . Left = panel . ClientSize . Width - 25 ;
50- nextPageControl . Top = 0 ;
51- nextPageControl . Width = 20 ;
52- nextPageControl . Anchor = AnchorStyles . Top | AnchorStyles . Left ;
53- nextPageControl . FlatAppearance . BorderSize = 0 ;
54- nextPageControl . BackgroundImageLayout = ImageLayout . Center ;
55- nextPageControl . BackgroundImage = nextImage ;
56- nextPageControl . Visible = nextVisible ;
46+ var nextPageControl = AddArrow ( panel , nextImage , nextVisible , true , 25 ) ;
5747 nextPageControl . Click += new EventHandler ( MainForm . Next_Click ) ;
58- //ControlList.Add(nextPageControl);
5948 Panel . Controls . Add ( nextPageControl ) ;
6049
61- var previousPageControl = new Button { Margin = new Padding ( 0 ) , Text = "" , FlatStyle = FlatStyle . Flat } ;
62- previousPageControl . Left = panel . ClientSize . Width - 90 ;
63- previousPageControl . Top = 0 ;
64- previousPageControl . Width = 20 ;
65- previousPageControl . Anchor = AnchorStyles . Top | AnchorStyles . Left ;
66- previousPageControl . FlatAppearance . BorderSize = 0 ;
67- previousPageControl . BackgroundImageLayout = ImageLayout . Center ;
68- previousPageControl . BackgroundImage = previousImage ;
69- previousPageControl . Visible = previousVisible ;
50+ var previousPageControl = AddArrow ( panel , previousImage , previousVisible , true , 90 ) ;
7051 previousPageControl . Click += new EventHandler ( MainForm . Previous_Click ) ;
71- //ControlList.Add(previousPageControl);
7252 Panel . Controls . Add ( previousPageControl ) ;
7353
74- var lastPageControl = new Button { Margin = new Padding ( 0 ) , Text = "" , FlatStyle = FlatStyle . Flat } ;
75- lastPageControl . Left = panel . ClientSize . Width - 25 ;
76- lastPageControl . Top = 0 ;
77- lastPageControl . Width = 20 ;
78- lastPageControl . Anchor = AnchorStyles . Top | AnchorStyles . Left ;
79- lastPageControl . FlatAppearance . BorderSize = 0 ;
80- lastPageControl . BackgroundImageLayout = ImageLayout . Center ;
81- lastPageControl . BackgroundImage = lastImage ;
82- lastPageControl . Visible = lastVisisble ;
83- lastPageControl . Enabled = false ;
84- //ControlList.Add(lastPageControl);
85- Panel . Controls . Add ( lastPageControl ) ;
86-
87- var firstPageControl = new Button { Margin = new Padding ( 0 ) , Text = "" , FlatStyle = FlatStyle . Flat } ;
88- firstPageControl . Left = panel . ClientSize . Width - 90 ;
89- firstPageControl . Top = 0 ;
90- firstPageControl . Width = 20 ;
91- firstPageControl . Anchor = AnchorStyles . Top | AnchorStyles . Left ;
92- firstPageControl . FlatAppearance . BorderSize = 0 ;
93- firstPageControl . BackgroundImageLayout = ImageLayout . Center ;
94- firstPageControl . BackgroundImage = firstImage ;
95- firstPageControl . Visible = firstVisible ;
96- firstPageControl . Enabled = false ;
97- //ControlList.Add(firstPageControl);
98- Panel . Controls . Add ( firstPageControl ) ;
54+ Panel . Controls . Add ( AddArrow ( panel , lastImage , lastVisible , false , 25 ) ) ;
55+ Panel . Controls . Add ( AddArrow ( panel , firstImage , firstVisible , false , 90 ) ) ;
9956
10057 var pageCountControl = new Label
10158 {
@@ -110,6 +67,21 @@ public NotificationPage(MainForm mainForm, Panel panel, Image nextImage, Image p
11067 Panel . Controls . Add ( pageCountControl ) ;
11168 }
11269
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 ;
83+ }
84+
11385 public class NDetail
11486 {
11587 public static readonly int TopPadding = 20 ;
0 commit comments