protected override void OnPaint(PaintEventArgs e) { try { //The renderhelper will rernder onto the graphics and also return a list of characters. //It is this list of characters that end up being used to decide what to send to the clipboard for MineCraft. RenderHelper = RenderHelper ?? new MinecraftTextRenderHelper(); RenderHelper.BackgroundColor = this.BackColor; //render everything. Todo: optimize if this turns out to be slow. this.MinecraftCharacters = RenderHelper.RenderCharactersUsingText(this.Text, e.Graphics, this.Page,false); UpdatePageCount(); } catch(Exception ex) { Debugger.Break(); //I want to detect this when debugging: it is vitally important to the application. } }
/// <summary> /// Ensures that the list of minecraftcharacters is properly filled; /// This is useful when the label that contains the text is not actually visible on screen. /// </summary> public void CalculateTextUsingRenderHelper() { RenderHelper = RenderHelper ?? new MinecraftTextRenderHelper(); RenderHelper.BackgroundColor = this.BackColor; this.MinecraftCharacters = RenderHelper.RenderCharactersUsingText(this.Text, this.CreateGraphics(), this.Page, false); UpdatePageCount(); }