public TextControl() { SuspendRemeasure(); myTextBox.TextChanged += new EventHandler(myTextBox_TextChanged); myTextBoxHost.BackColor = Color.Transparent; myTextBox.LostFocus += new EventHandler(myTextBox_LostFocus); myTextBox.Font = myLabel.Font; myTextBox.BorderStyle = BorderStyle.None; myTextBox.Visible = false; OverlayPanel overlay = new OverlayPanel(); WindowlessRectangle rectangle = new WindowlessRectangle(); rectangle.Color = SystemColors.ControlDarkDark; rectangle.Filled = false; DockPanel dockPanel = new DockPanel(); dockPanel.Margin = new Thickness(2, 2, 2, 2); OnSetupDockPanel(dockPanel); overlay.Controls.Add(rectangle); overlay.Controls.Add(dockPanel); overlay.FitWidthControl = overlay.FitHeightControl = dockPanel; Control = overlay; ResumeRemeasure(); Remeasure(); }
private void ShowOverlayText(string text) { if (false == OverlayTextBox.Visible) { OverlayTextBox.ForeColor = Color.FromKnownColor(KnownColor.ControlText); OverlayTextBox.Text = text; OverlayPanel.Visible = true; OverlayPanel.BringToFront(); } }
private void ShowOverlayError(Exception exception) { if (false == OverlayTextBox.Visible) { OverlayTextBox.ForeColor = Color.Red; OverlayTextBox.Text = "An unexpected error occured." + Environment.NewLine + Environment.NewLine + exception.ToString(); OverlayPanel.Visible = true; OverlayPanel.BringToFront(); } }
protected virtual void OnSetupDockPanel(DockPanel dockPanel) { OverlayPanel overlay = new OverlayPanel(); overlay.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Left); myLabel.VerticalAlignment = VerticalAlignment.Center; myLabel.Margin = new Thickness(0, 0, 6, 0); overlay.Controls.Add(myLabel); myTextBoxHost.HostControl(myTextBox, true, false); overlay.Controls.Add(myTextBoxHost); overlay.FitHeightControl = overlay.FitWidthControl = myLabel; dockPanel.Controls.Add(overlay); }
//=================================== //=================================== // INITIALIZATION //=================================== //=================================== void Start() { // connect to external modules guiComponents = GetComponent <GuiComponents>(); levelManager = GetComponent <LevelManager>(); scoringSystem = GetComponent <ScoringSystem>(); inputControls = GetComponent <InputControls>(); overlayPanel = GetComponent <OverlayPanel>(); infoPanel = GetComponent <InfoPanel>(); feedingDisplay = GetComponent <FeedingDisplay>(); gameplayDisplay = GetComponent <GameplayDisplay>(); // additional initialization SetGuiState("guiStateStartApp1"); infoPanelVisible = true; infoPanelTransStart = Time.time - 100000; customGUISkin.button.normal.textColor = new Color(0.90f, 0.65f, 0f, 1f); customGUISkin.button.hover.textColor = new Color(0.99f, 0.75f, 0.21f, 1f); }
public DropdownControl(WindowlessControlHost dropdownSource, IWindowlessControl dropdownContent) { AutoScroll = true; Orientation = Orientation.Vertical; myDropdownSource = dropdownSource; OverlayPanel overlay = new OverlayPanel(); WindowlessRectangle rectangle = new WindowlessRectangle(); rectangle.Color = SystemColors.ControlDarkDark; rectangle.Filled = false; overlay.Controls.Add(rectangle); OverlayPanel inner = new OverlayPanel(); inner.Margin = new Thickness(1, 1, 1, 1); inner.Controls.Add(dropdownContent); overlay.Controls.Add(inner); overlay.FitHeightControl = overlay.FitWidthControl = inner; Control = overlay; }
public StationPresenter() { OverlayPanel overlay = new OverlayPanel(); // stretch to fit overlay.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch; overlay.VerticalAlignment = VerticalAlignment.Stretch; // dock the picture to the right and the info to the left DockPanel dock = new DockPanel(); StackPanel left = new StackPanel(); left.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Left); //m_Image.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Right); //m_Image.MaxHeight = 100; //m_Image.MaxWidth = 100; //dock.Controls.Add(m_Image); m_Distance.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Right); m_Distance.MaxHeight = 100; m_Distance.MaxWidth = 100; dock.Controls.Add(m_Distance); dock.Controls.Add(left); // 5 pixel border around the item contents dock.Margin = new Thickness(5, 5, 5, 5); // make the overlay fit the dock, so as to limit the size of the selection rectangle overlay.FitWidthControl = overlay.FitHeightControl = dock; // set up the rectangle color and make it fill the region m_Rectangle.Color = SystemColors.Highlight; m_Rectangle.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch; m_Rectangle.VerticalAlignment = VerticalAlignment.Stretch; // the rectangle does not paint by default m_Rectangle.PaintSelf = false; // add the extended info that is only visible when focused StackPanel nameAndNumber = new StackPanel(); nameAndNumber.Controls.Add(m_StationName); nameAndNumber.Controls.Add(m_StationNumber); m_ExtendedInfo.Visible = false; m_ExtendedInfo.Controls.Add(m_StationAddress); // set up the left side left.Controls.Add(nameAndNumber); left.Controls.Add(m_ExtendedInfo); // add the foreground and the background selection overlay.Controls.Add(m_Rectangle); overlay.Controls.Add(dock); // add the item Controls.Add(overlay); // this is the bottom border WindowlessRectangle bottomBorder = new WindowlessRectangle(Int32.MaxValue, 1, Color.Gray); Controls.Add(bottomBorder); }