using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace GUI { public partial class Steam : UserControl { public Trackerscheme T; Graphics gGraphics; Pen pPen; Brush bBrush; Font fFont; Bitmap bBitmap; public Steam() { bBitmap = Properties.Resources.steam; bBitmap.MakeTransparent(); T = new Trackerscheme(); gGraphics = this.CreateGraphics(); fFont = new Font("verdana", 10f); InitializeComponent(); } private void DrawTextBox(Rectangle rect) { //Draw the back. bBrush = new SolidBrush( T.WindowBG ); gGraphics.FillRectangle(bBrush, rect); //Top & Left pPen = new Pen(T.BorderDark); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X + rect.Width, rect.Y)); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height)); //Bottom & Right pPen = new Pen(T.BorderBright); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y + rect.Height), new Point(rect.X + rect.Width, rect.Y + rect.Height)); gGraphics.DrawLine(pPen, new Point(rect.X + rect.Width, rect.Y), new Point(rect.X + rect.Width, rect.Y + rect.Height)); //Text bBrush = new SolidBrush(T.BaseText); gGraphics.DrawString("Hello", fFont, bBrush, (float)rect.X, (float)rect.Y); bBrush = new SolidBrush(T.SelectionBG); gGraphics.FillRectangle(bBrush, new Rectangle(rect.X + 39, rect.Y + 2, rect.X + 21, rect.Height - 4)); bBrush = new SolidBrush(T.SelectedText); gGraphics.DrawString("Worl", fFont, bBrush, (float)rect.X + 38, (float)rect.Y); bBrush = new SolidBrush(T.BaseText); gGraphics.DrawString("d", fFont, bBrush, (float)rect.X + 66, (float)rect.Y); } private void DrawConsole(Rectangle rect) { bBrush = new SolidBrush(T.WindowBG); gGraphics.FillRectangle(bBrush, rect); //Top & Left pPen = new Pen(T.BorderDark); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X + rect.Width, rect.Y)); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height)); //Bottom & Right pPen = new Pen(T.BorderBright); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y + rect.Height), new Point(rect.X + rect.Width, rect.Y + rect.Height)); gGraphics.DrawLine(pPen, new Point(rect.X + rect.Width, rect.Y), new Point(rect.X + rect.Width, rect.Y + rect.Height)); //Draw Highlights behind text bBrush = new SolidBrush(T.SelectionBG); gGraphics.FillRectangle(bBrush, new Rectangle(rect.X + 16, rect.Y + 18, 205, 14)); bBrush = new SolidBrush(T.SelectionBG2); gGraphics.FillRectangle(bBrush, new Rectangle(rect.X + 16, rect.Y + 32, 340, 14)); //Text bBrush = new SolidBrush(T.BrightBaseText); gGraphics.DrawString("] This is an example console with various text.", fFont, bBrush, (float)rect.X + 3, (float)rect.Y + 3); bBrush = new SolidBrush(T.SelectedText); gGraphics.DrawString("] This text has been highlighted.", fFont, bBrush, (float)rect.X + 3, (float)rect.Y + 17); gGraphics.DrawString("] This text has been highlighted and then lost focus.", fFont, bBrush, (float)rect.X + 3, (float)rect.Y + 31); //Draw Slider Bar. //Bar bBrush = new SolidBrush(T.ControlDarkBG); gGraphics.FillRectangle(bBrush, new Rectangle( rect.Width - 7, rect.Y + 1, 16, rect.Height - 2 )); //Boxes bBrush = new SolidBrush(T.ControlBG); gGraphics.FillRectangle(bBrush, new Rectangle(rect.Width - 7, rect.Y + 1, 16, 16)); gGraphics.FillRectangle(bBrush, new Rectangle(rect.Width - 7, rect.Y + rect.Height - 17, 16, 16)); gGraphics.FillRectangle(bBrush, new Rectangle(rect.Width - 7, rect.Y + 30, 16, 95)); //Outlines pPen = new Pen(T.BorderBright); //top bright gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + 1), new Point(rect.Width - 7, rect.Y + 16)); //bottom bright gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + rect.Height - 17), new Point(rect.Width - 7, rect.Y + rect.Height - 2)); gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + rect.Height - 17), new Point(rect.Width + 8, rect.Y + rect.Height - 17)); //scroll bright gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + 30), new Point(rect.Width + 8, rect.Y + 30)); gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + 30), new Point(rect.Width - 7, rect.Y + 125)); pPen = new Pen(T.BorderDark); //top dark gGraphics.DrawLine(pPen, new Point(rect.Width + 8, rect.Y + 1), new Point(rect.Width + 8, rect.Y + 16 )); gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + 16), new Point(rect.Width + 8, rect.Y + 16)); //bottom dark gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + rect.Height - 2), new Point(rect.Width + 8, rect.Y + rect.Height - 2)); gGraphics.DrawLine(pPen, new Point(rect.Width + 8, rect.Y + rect.Height - 17), new Point(rect.Width + 8, rect.Y + rect.Height - 2)); //scroll dark gGraphics.DrawLine(pPen, new Point(rect.Width - 7, rect.Y + 125), new Point(rect.Width + 8, rect.Y + 125)); gGraphics.DrawLine(pPen, new Point(rect.Width + 8, rect.Y + 30), new Point(rect.Width + 8, rect.Y + 125)); } private void DrawButton(int x, int y) { Rectangle rect = new Rectangle(x, y, 64, 18); //Top & Left pPen = new Pen(T.BorderBright); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X + rect.Width, rect.Y)); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height)); //Bottom & Right pPen = new Pen(T.BorderDark); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y + rect.Height), new Point(rect.X + rect.Width, rect.Y + rect.Height)); gGraphics.DrawLine(pPen, new Point(rect.X + rect.Width, rect.Y), new Point(rect.X + rect.Width, rect.Y + rect.Height)); bBrush = new SolidBrush(T.BrightBaseText); gGraphics.DrawString("Ok", fFont, bBrush, (float)rect.X+2, (float)rect.Y+1); } private void DrawX(int x, int y) { Rectangle rect = new Rectangle(x - 3, y - 3, 16, 16); //Top & Left pPen = new Pen(T.BorderBright); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X + rect.Width, rect.Y)); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y), new Point(rect.X, rect.Y + rect.Height)); //Bottom & Right pPen = new Pen(T.BorderDark); gGraphics.DrawLine(pPen, new Point(rect.X, rect.Y + rect.Height), new Point(rect.X + rect.Width, rect.Y + rect.Height)); gGraphics.DrawLine(pPen, new Point(rect.X + rect.Width, rect.Y), new Point(rect.X + rect.Width, rect.Y + rect.Height)); //Draw X. pPen = new Pen(T.BorderBright, 2f); gGraphics.DrawLine(pPen, new Point(x, y), new Point(x + 9, y + 9)); gGraphics.DrawLine(pPen, new Point(x + 9, y), new Point(x, y + 9)); } protected override void OnPaint(PaintEventArgs e) { #region Main Window gGraphics = this.CreateGraphics(); bBrush = new SolidBrush(T.ControlBG); gGraphics.FillRectangle(bBrush, new Rectangle(0, 0, Width, Height)); //borders. pPen = new Pen(T.BorderBright); gGraphics.DrawLine(pPen, new Point(0, 0), new Point(Width, 0)); pPen = new Pen(T.BorderBright); gGraphics.DrawLine(pPen, new Point(0, 0), new Point(0, Height)); pPen = new Pen(T.BorderDark); gGraphics.DrawLine(pPen, new Point(Width - 1, 0), new Point(Width - 1, Height - 1)); pPen = new Pen(T.BorderDark); gGraphics.DrawLine(pPen, new Point(0, Height - 1), new Point(Width - 1, Height - 1)); //BG behind the title. bBrush = new SolidBrush( T.TitleBG ); gGraphics.FillRectangle(bBrush, new Rectangle(2, 2, Width - 4, 100)); //Draw the title text. bBrush = new SolidBrush(T.TitleText); gGraphics.DrawString("Example Title", fFont, bBrush, 20f, 2f); #endregion //Draw simple box with highlighting. DrawTextBox( new Rectangle( 10, 466, 360, 18 ) ); DrawButton(380, 466); //Show Steam icon. gGraphics.DrawImage(bBitmap, 2, 2); //Draw console. DrawConsole(new Rectangle(10, 257, 434, 200)); //Draw X button. DrawX(this.Width - 22, 12); base.OnPaint(e); } } }