private void Init() { mBackgroundSurf = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbarbutton.png")); if (mWindow.TaskBarText != "") { Gfx.Font font = Logic.Graphics.FontManager.LoadFont("tahoma", 12); Gfx.Surface textSurf = font.Render(mWindow.TaskBarText, Color.White); //textSurf = textSurf.CreateStretchedSurface(new Size(130, 12)); mBackgroundSurf.Blit(textSurf, GetCenter(mBackgroundSurf, textSurf.Size), new Rectangle(0, 0, 125, 14)); string stateString = "?"; switch (mWindow.WindowState) { case Client.Logic.Windows.WindowManager.WindowState.Normal: stateString = "^"; break; case Client.Logic.Windows.WindowManager.WindowState.Minimized: stateString = "v"; break; case Client.Logic.Windows.WindowManager.WindowState.Maximized: stateString = "[]"; break; } mBackgroundSurf.Blit(font.Render(stateString, Color.White), new Point(this.Width - font.SizeText(stateString).Width - 1, 0)); font.Close(); } base.Buffer.Blit(mBackgroundSurf, new Point(0, 0)); }
private void UpdateBackground() { mBackground = new SdlDotNet.Graphics.Surface(base.Size); base.Buffer.Fill(mBackColor); if (mBackColor.A != 0) { mBackground.Fill(mBackColor); } else { mBackground.Transparent = true; mBackground.TransparentColor = Color.Transparent; mBackground.Fill(Color.Transparent); } mCheckedBoxBounds = new Rectangle(new Point(2, 2), new Size(this.Height - 4, this.Height - 4)); Gfx.Primitives.Box box = new SdlDotNet.Graphics.Primitives.Box(mCheckedBoxBounds.Location, mCheckedBoxBounds.Size); mBackground.Draw(box, Color.Black); if (mChecked) { Gfx.Surface filled = new SdlDotNet.Graphics.Surface(box.Size); filled.Fill(Color.Black); mBackground.Blit(filled, box.Location); filled.Close(); filled.Dispose(); } if (mText != "") { Gfx.Font font = new Gfx.Font(IO.IO.CreateOSPath("Fonts\\PMU.ttf"), this.Height); mBackground.Blit(font.Render(mText, mForeColor, mAntiAlias), new Point(20, -4)); font.Close(); } base.Buffer.Blit(mBackground, new Point(0, 0)); }
public void FreeResources() { if (buffer != null) { buffer.Close(); buffer = null; } if (font != null) { font.Close(); font = null; } }