internal static RichLabel TextBold(this RichLabel label, String text, SystemDrawing.Color color = default(SystemDrawing.Color)) { color = color == SystemDrawing.Color.Empty ? SystemDrawing.Color.Black : color; if (Globals.Style.BoldFont == null) { Globals.Style.BoldFont = new Font(label.Skin.Renderer, Configs.RegularBoldFontName, 16); } var measure = label.Skin.Renderer.MeasureText(Globals.Style.BoldFont, text); int?width = null, height = null; if (measure.X > label.Width) { width = label.Width + measure.X; } if (measure.Y > label.Height) { height = label.Height + measure.Y; } if (width.HasValue || height.HasValue) { label.SetSize(width.HasValue ? width.Value : label.Width, height.HasValue ? height.Value : label.Height); } label.Text(text, color, Globals.Style.BoldFont); return(label); }
protected override void Layout(GwenSkin.Base skin) { base.Layout(skin); if (!mLayoutRequired) { return; } mLayoutRequired = false; if (LabelColor.HasValue) { mLabel.AddText(LabelText, LabelColor.Value); } else { mLabel.AddText(LabelText, SystemDrawing.Color.Black); } if (!WordWrapLabel) { var measure = mLabel.Skin.Renderer.MeasureText(LabelFont, LabelText); mLabel.SetSize(measure.X, measure.Y); //Function.Log(String.Format("WordWrap disabled {0} {1} {2} {3} {4} {5}", measure.X, measure.Y, LabelColor.HasValue ? LabelColor.Value.ToString() : "none", LabelFont.FaceName, LabelFont.Size, LabelText)); } else { mLabel.SizeToChildren(); } //if (WordWrapLabel) //{ // mLabel.SizeWidthWith(this); // mLabel.SizeToChildren(false, true); //} //else // mLabel.SizeToChildren(true, true); switch (LabelPosition) { case RelationalPosition.LEFT: Component.PlaceRightOf(mLabel, mSpaceBetweenLabelAndComponent); break; case RelationalPosition.RIGHT: mLabel.PlaceRightOf(Component, mSpaceBetweenLabelAndComponent); break; case RelationalPosition.TOP: Component.PlaceBelowOf(mLabel, mSpaceBetweenLabelAndComponent); break; case RelationalPosition.BOTTOM: mLabel.PlaceBelowOf(Component, mSpaceBetweenLabelAndComponent); break; } mLabel.LogPositionAndSize(); Component.LogPositionAndSize(); this.SizeToChildren(); }
public ArrestReportDetails(Base parent) : base(parent) { //Top this.TopDock.Height = 75; Base instructionsContainer = new Base(this.TopDock); instructionsContainer.Dock = Pos.Fill; RichLabel instructions = new RichLabel(instructionsContainer); instructions.AddText("Please enter in the details for the arrest report below.", System.Drawing.Color.Black); instructions.AddLineBreak(); instructions.AddText("Toggle the Party button. Double click a party in the right pane to quickly insert their name into the report", System.Drawing.Color.Black); instructions.SetSize(600, this.TopDock.Height); instructions.Position(Pos.Top, 25, 15); //this.TopDock.FitChildrenToSize(); //Center/Fill reportDetailsTextBox = new StateControlledMultilineTextbox(this); reportDetailsTextBox.Dock = Pos.Fill; reportDetailsTextBox.TextChanged += ReportDetailsTextChanged; reportDetailsTextBox.ForceWordWrap = false; //Bottom this.BottomDock.Height = 60; Base actionButtonContainer = new Base(this.BottomDock); actionButtonContainer.Dock = Pos.Fill; transferTextFromSimpleNotepad = new Button(actionButtonContainer); transferTextFromSimpleNotepad.SetToolTipText("Transfer from SimpleNotepad"); transferTextFromSimpleNotepad.CopyContentIcon(); transferTextFromSimpleNotepad.Position(Pos.Top, 25, 15); transferTextFromSimpleNotepad.Clicked += ActionButtonClicked; //Right this.RightDock.Width = 200; lb_allParties = new ListBox(this); lb_allParties.IsTabable = true; lb_allParties.RowSelected += PartyListItemClicked; AllButton = this.RightDock.TabControl.AddPage("All", lb_allParties); AllButton.UserData = ArrestReportAdditionalParty.PartyTypes.UNKNOWN; WitnessButton = this.RightDock.TabControl.AddPage("Witnesses", lb_allParties); WitnessButton.UserData = ArrestReportAdditionalParty.PartyTypes.WITNESS; VictimButton = this.RightDock.TabControl.AddPage("Victims", lb_allParties); VictimButton.UserData = ArrestReportAdditionalParty.PartyTypes.VICTIM; //var accomplices = this.RightDock.TabControl.AddPage("Accomplices", lb_allParties); //accomplices.UserData = ArrestReportAdditionalParty.PartyTypes.ACCOMPLICE; //all.Press(); //Must trigger before we add the rest of the pressed handlers AllButton.Pressed += FilteredPartiesButtonPressed; WitnessButton.Pressed += FilteredPartiesButtonPressed; VictimButton.Pressed += FilteredPartiesButtonPressed; //accomplices.Pressed += FilteredPartiesButtonPressed; }