private void AddButton(string title) { if ((y + step) > panelNavigation.Height) { y = header.Height + margin; x = panelNavigation.Width / 2 + margin; } Button btn = new Button(x, y, w, h, DemoManager.FontCourierNew10, title, Color.White) { BackgroundUnpressed = DemoManager.Bar }; btn.Click += new EventHandler(btn_Click); panelNavigation.Children.Add(btn); y += step; }
public DemoPage() : base(0, 0, DemoManager.Desktop.Width, DemoManager.Desktop.Height) { //Background = new SolidColorBrush(Color.CornflowerBlue) { Opacity = 256 }; Background = new LinearGradientBrush(Color.Bisque, Color.Black, 0, 0, 1000, 1000, 220); btnBack = new Button(0, 0, 70, 24, DemoManager.FontCourierNew10, "Back", Color.White) { BackgroundUnpressed = DemoManager.Bar }; btnBack.Click += btnBack_Click; Children.Add(btnBack); int y = btnBack.Height + 10; Content = new Panel(0, y, Width, Height - y); Children.Add(Content); }
private Control InitStatusBar() { Panel statusPanel = new Panel(0, Height - 32, Width, 32); statusPanel.Background = new ImageBrush(Program.ToolbarBackground) { Opacity = Program.ToolbarOpacity, Stretch = Stretch.Fill }; // left part btnHome = new Button(0, 0, 70, 32) { Foreground = new ImageBrush(Program.ImageHome) };//, new Image(Program.ImageHome, 22)); btnHome.Border = null; btnHome.Click += new EventHandler(btnHome_Click); statusPanel.Children.Add(btnHome); // right part int x = statusPanel.Width - 400; iconUSBMassSrorage = new Image(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize, Program.ImageDrive); iconUSBMassSrorage.Visible = USBDeviceManager.GetCount(USBH_DeviceType.MassStorage) != 0; statusPanel.Children.Add(iconUSBMassSrorage); x += iconUSBMassSrorage.Width + 4; iconUSBMouse = new Image(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize, Program.ImageMouse); iconUSBMouse.Visible = USBDeviceManager.GetCount(USBH_DeviceType.Mouse) != 0; statusPanel.Children.Add(iconUSBMouse); x += iconUSBMouse.Width + 4; iconUSBKeyboard = new Image(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize, Program.ImageKeyboard); iconUSBKeyboard.Visible = USBDeviceManager.GetCount(USBH_DeviceType.Keyboard) != 0; statusPanel.Children.Add(iconUSBKeyboard); x += iconUSBKeyboard.Width + 4; iconNetwork = new MultiImage(x, 0, Program.ButtonLargeIconSize, Program.ButtonLargeIconSize); iconNetwork["NetworkOn"] = new ImageBrush(Program.ImageNetworkOn); iconNetwork["NetworkOff"] = new ImageBrush(Program.ImageNetworkOff); iconNetwork.ActiveBrushID = "NetworkOff"; statusPanel.Children.Add(iconNetwork); x += iconNetwork.Width + 8; statusPanel.Children.Add(InitBoosterUIBlock(ref x, out iconMainBooster1State, out lblMainBooster1Current, out lvlMainBooster1Current)); statusPanel.Children.Add(InitBoosterUIBlock(ref x, out iconMainBooster2State, out lblMainBooster2Current, out lvlMainBooster2Current)); statusPanel.Children.Add(InitBoosterUIBlock(ref x, out iconProgBoosterState, out lblProgBoosterCurrent, out lvlProgBoosterCurrent)); x += 4; btnPower = new Button(x, 0, 70, Program.ButtonLargeIconSize); btnPower.Foreground = new ImageBrush(Program.ImagePowerOff); btnPower.Border = null; btnPower.Click += new EventHandler(btnPower_Click); statusPanel.Children.Add(btnPower); x += btnPower.Width + 10; lblClock = new Label(x, 9, Program.FontRegular, "00:00:00") { ForeColor = Program.LabelTextColor }; statusPanel.Children.Add(lblClock); return statusPanel; }