How would I place code to get the background a different color, instead of transparent to the systray?
Code:private void CreateIcon(int temperature) { // Create a graphics instance that draws to a bitmap Bitmap bitmap = new Bitmap(16, 16, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Graphics graphics = Graphics.FromImage(bitmap); // FONT System.Drawing.Font drawFont = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold); // TEXT string drawString = temperature.ToString(); SizeF drawStringSize = new SizeF(); //Measure the Copyright string in this Font drawStringSize = graphics.MeasureString(drawString, drawFont); // BRUSH System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush( Color.FromArgb(255, 255, 255, 255)); // center text in icon image graphics.DrawString(drawString, drawFont, drawBrush, 16 / 2 - drawStringSize.Width / 2, 16 / 2 - drawStringSize.Height / 2); notifyWeather.Icon = System.Drawing.Icon.FromHandle(bitmap.GetHicon()); drawFont.Dispose(); drawBrush.Dispose(); graphics.Dispose(); }




Reply With Quote