public void SetFont(System.Drawing.Font font) { if (ctx.InvokeRequired) { FontDelegate c = new FontDelegate(SetFont); ctx.Invoke(c, new object[] { font }); return; } supressEvent = true; int inputX = input.Size.Width; int inputY = input.Size.Height; input.Font = font; output.Font = font; System.Drawing.Size nSize = TextRenderer.MeasureText("T", font); input.Size = new System.Drawing.Size(input.Size.Width, nSize.Height + 4); //+4 for the cursor to display if (sync != SyncMode.syncWindow) { SyncMode backup = sync; sync = SyncMode.syncWindow; SyncUI(nSize.Width - inputX, nSize.Height - inputY, false); sync = backup; } supressEvent = false; }
/// <summary> /// Creates a text box that does nice things. /// </summary> /// <param name="space">The screen space this text box has available.</param> public HelpfulTextBox(Rectangle space, FontDelegate font) { screenSpace = space; this.font = font; previousFrameFormattedText = new string[0]; spacesVector = font().MeasureString(spacesPerIcon); replaceLR1 = new Vector2(spacesVector.X * 0.5f, spacesVector.Y * 0.5f); replaceLR2 = new Vector2(spacesVector.X * 1.5f + font().MeasureString(" ").X, spacesVector.Y * 0.5f); replaceSorBV = new Vector2(spacesVector.X * 0.5f, spacesVector.Y * 0.5f); replaceCam1 = new Vector2(spacesVector.X * 0.5f, spacesVector.Y * 0.5f); stringPos = new Vector2(screenSpace.X, screenSpace.Y); }
public static void SetMFontFun(FontDelegate fun) { getMFontFun = fun; }
public Dock(TextureDelegate dockTex, FontDelegate font) { texture = new Sprite(dockTex, new Vector2(-dockTex().Width, 120), null, Sprite.RenderPoint.UpLeft); fontDelegate = font; }
public static void RegisterFontDelegate(FontDelegate func) { _fontHandler = func; }