/// <summary> /// Constructor of a true false column that creates a column /// using, be default, a check mark for true and no image for false values. /// </summary> /// <param name="field">The field within a dataview to use for the column.</param> /// <param name="maxWidth">The maximum width for this column</param> public ReportBoolColumn(string field, float maxWidth) : base(field, maxWidth) { Bitmap trueBmp = new Bitmap (GetType(), DefaultTrueImageName); trueBmp.MakeTransparent (); TrueImage = trueBmp; }
public Form1() { cursor = VNCMenuWalker.Properties.Resources.Cursor; cursor.MakeTransparent(Color.FromArgb(34, 177, 76)); InitializeComponent(); }
public Enemy(GameWorld game, string path) : base(game) { Bitmap b = new Bitmap(path); b.MakeTransparent(Color.Black); image = b; }
internal void ChangeCursorColor(Color newColor) { WFBitmap bitmap = wfBitmap; bitmap.MakeTransparent(WFColor.Magenta); WFColor color = WFColor.FromArgb(newColor.A, newColor.R, newColor.G, newColor.B); for (int i = 0; i < (bitmap.Width - 1); i++) { for (int j = 0; j < (bitmap.Height - 1); j++) { WFColor pixel = bitmap.GetPixel(i, j); if (((pixel.A == WFColor.Black.A) && (pixel.R == WFColor.Black.R)) && ((pixel.B == WFColor.Black.B) && (pixel.G == WFColor.Black.G))) { bitmap.SetPixel(i, j, color); } } } MemoryStream stream = new MemoryStream(); bitmap.Save(stream, WFImageFormat.Png); stream.Position = 0L; BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = stream; bitmapImage.EndInit(); image.Source = bitmapImage; }
public static System.Drawing.Image GetResourceImage(System.Reflection.Assembly asm, string resourceName) { if (asm == null) { return(null); } if (resourceName != null && resourceName.Trim().Length > 0) { System.IO.Stream stream = asm.GetManifestResourceStream(resourceName); if (stream != null) { byte[] bs = new byte[stream.Length]; stream.Read(bs, 0, bs.Length); System.IO.MemoryStream ms = new System.IO.MemoryStream(bs); System.Drawing.Image img2 = System.Drawing.Image.FromStream(ms); if (img2 is System.Drawing.Bitmap) { System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)img2; bmp.MakeTransparent(bmp.GetPixel(0, bmp.Height - 1)); } return(img2); } } return(null); }
public void Box(Size size, Color color, bool noUpSizing, int maxWidth, int maxHeight) { // First we resize the image so that it will fit in our bounding box. Resize(size, true, noUpSizing, maxWidth, maxHeight); // Check for 0 lengths... :S if (size.Width == 0) size.Width = _bitmap.Width; if (size.Height == 0) size.Height = _bitmap.Height; Bitmap newBitmap = new Bitmap(size.Width, size.Height); bool isTransparent = (color == Color.Transparent); if (isTransparent) { newBitmap.MakeTransparent(); ConvertToImageFormat(ImageFormat.Png); } // Calculate position for the image int x = (size.Width - _bitmap.Width) / 2; int y = (size.Height - _bitmap.Height) / 2; using (Graphics g = Graphics.FromImage(newBitmap)) { if (!isTransparent) g.Clear(color); g.DrawImage(_bitmap, new Point(x, y)); } _bitmap = newBitmap; }
public static ILayer CreateLayer(string fileName, string bitmapBase) { // create layer DawnLayer layer = new DawnLayer(System.IO.Path.GetFileNameWithoutExtension(fileName)); layer.Category = LayerCategory.POI; string iconFile = fileName.Substring(0, fileName.LastIndexOf(".poi")) + ".bmp"; if (System.IO.File.Exists(iconFile)) { Bitmap bmp = new Bitmap(iconFile); bmp.MakeTransparent(System.Drawing.Color.Magenta); layer.Icon = bmp; } //else //layer.Icon = new Bitmap(new System.Drawing.Bitmap(typeof(AMLayerFactory), "Resources.DefaultPOIIcon.bmp")); // initialize data source AMProvider pointProv = new AMProvider( @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName, "_IndexData", "AUTOINC", "X", "Y"); layer.DataSource = pointProv; // initialize style AMStyle amStyle = new AMStyle(fileName, bitmapBase); if(amStyle.MaxVisible > 0) layer.MaxVisible = amStyle.MaxVisible; layer.Theme = amStyle; return layer; }
/// <summary> /// Draws a signature using the journal font. /// </summary> /// <param name="name">User's name to create a signature for.</param> /// <param name="fontPath">Full path of journal.ttf. Should be passed if system doesn't have the font installed.</param> /// <returns>Bitmap image containing the user's signature.</returns> public Bitmap SigNameToImage(string name, string fontPath ) { //we need a reference to the font, be it the .tff in the site project or the version installed on the host if (string.IsNullOrEmpty(fontPath) && !FontFamily.Families.Any(f => f.Name.Equals(FONT_FAMILY))) { throw new ArgumentException("FontPath must point to the copy of journal.ttf when the system does not have the font installed", "fontPath"); } Bitmap signatureImage = new Bitmap(Width, Height); signatureImage.MakeTransparent(); using (Graphics signatureGraphic = Graphics.FromImage(signatureImage)) { signatureGraphic.Clear(Background); Font font; if (!string.IsNullOrEmpty(fontPath)) { //to make sure the host doesn't need the font installed, use a private font collection PrivateFontCollection collection = new PrivateFontCollection(); collection.AddFontFile(fontPath); font = new Font(collection.Families.First(), FontSize); } else { //fall back to the version installed on the host font = new Font(FONT_FAMILY, FontSize); } signatureGraphic.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; signatureGraphic.DrawString(name ?? string.Empty, font, new SolidBrush(PenColor), new PointF(0, 0)); } return signatureImage; }
public override System.Drawing.Bitmap GetNext() { if (this.nowState == MarqueeDisplayState.First) { this.nowPosition = (int)this.nowPositionF; int arg_2C_0 = (this.newBitmap.Width - this.nowPosition) / 2; System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(this.newBitmap); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap); this.GetLeft(this.nowPosition); System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Silver); System.Drawing.Bitmap bitmap2 = new System.Drawing.Bitmap(this.newBitmap.Width, this.newBitmap.Height); System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(bitmap2); graphics2.Clear(System.Drawing.Color.Black); graphics2.FillPolygon(solidBrush, this.pointLeft); graphics2.Dispose(); bitmap2.MakeTransparent(System.Drawing.Color.Silver); graphics.DrawImage(bitmap2, new System.Drawing.Point(0, 0)); bitmap2.Dispose(); solidBrush.Dispose(); graphics.Dispose(); this.nowPositionF -= this.step; if (this.nowPositionF <= 0f) { this.nowState = MarqueeDisplayState.Stay; } return(bitmap); } return(null); }
public DrivesForm() { // // Required for Windows Form Designer support // InitializeComponent(); // Small and large image lists lvDrives.SmallImageList = new ImageList(); Bitmap icoSmall = new Bitmap(GetType(), "LvIcons.bmp"); icoSmall.MakeTransparent(Color.FromArgb(0xff, 0x00, 0xff)); lvDrives.SmallImageList.Images.AddStrip(icoSmall); lvDrives.LargeImageList = new ImageList(); Bitmap icoLarge = new Bitmap(GetType(), "LvIconsLarge.bmp"); icoLarge.MakeTransparent(Color.FromArgb(0xff, 0x00, 0xff)); Size sizeImages = new Size(32,32); lvDrives.LargeImageList.ImageSize = sizeImages; lvDrives.LargeImageList.Images.AddStrip(icoLarge); lvDrives.Columns.Add("Drive", 100, HorizontalAlignment.Left); lvDrives.Columns.Add("Type", 150, HorizontalAlignment.Left); ListDrives(); }
public Options() { InitializeComponent(); // set the background transparent for the skin immages Bitmap bm1 = new Bitmap(Resource.skin); bm1.MakeTransparent(Color.FromArgb(255, 0, 255)); pictureBox1.Image = bm1; Bitmap bm2 = new Bitmap(Resource.skin2); bm2.MakeTransparent(Color.FromArgb(255, 0, 255)); pictureBox2.Image = bm2; Bitmap bm3 = new Bitmap(Resource.skin3); bm3.MakeTransparent(Color.FromArgb(255, 0, 255)); pictureBox3.Image = bm3; // initialize pannels panelMessagesCategories.Top = panelGeneral.Top; panelMessagesCategories.Left = panelGeneral.Left; panelMessagesUpdate.Top = panelGeneral.Top; panelMessagesUpdate.Left = panelGeneral.Left; panelSkinGeneral.Top = panelGeneral.Top; panelSkinGeneral.Left = panelGeneral.Left; panelMessagesGeneral.Top = panelGeneral.Top; panelMessagesGeneral.Left = panelGeneral.Left; treeView1.SelectedNode = treeView1.Nodes[0]; }
public void GenerateEnemy() { Graphics _graphics; SolidBrush b = new SolidBrush(GhostColor); SolidBrush _eyeBrush = new SolidBrush(Color.White); SolidBrush _pupilBrush = new SolidBrush(Color.FromArgb(34, 32, 216)); SolidBrush _coverBrush = new SolidBrush(Color.Black); Point _p = new Point(-1, -1); int _width = 30; int _height = 30; Bitmap _bmpCharBase = new Bitmap(_width, _height); _bmpCharBase = new Bitmap(_width, _height); _graphics = Graphics.FromImage(_bmpCharBase); _graphics.SmoothingMode = SmoothingMode.AntiAlias; _graphics.FillEllipse(b, _p.X + 3, _p.Y, _width - 4, _height - 2); _graphics.FillRectangle(b, _p.X + 3, _p.Y + _height / 2 - 1, _width - 4, _height / 2); BmpCharUp1 = (Bitmap)_bmpCharBase.Clone(); _graphics = Graphics.FromImage(BmpCharUp1); _graphics.SmoothingMode = SmoothingMode.AntiAlias; _graphics.FillPie(_coverBrush, _p.X + 3, _p.Y + _height - 11, 10, 11, 45, 90); _graphics.FillRectangle(_coverBrush, _p.X + (_width / 2 - 1), _p.Y + _height - 5, 4, 5); _graphics.FillPie(_coverBrush, _p.X + _width - 11, _p.Y + _height - 11, 10, 11, 45, 90); BmpCharUp1.MakeTransparent(Color.Black); }
public GridErrorDlg(PropertyGrid owner) { ownerGrid = owner; expandImage = new Bitmap(typeof(ThreadExceptionDialog), "down.bmp"); expandImage.MakeTransparent(); if (DpiHelper.IsScalingRequired) { DpiHelper.ScaleBitmapLogicalToDevice(ref expandImage); } collapseImage = new Bitmap(typeof(ThreadExceptionDialog), "up.bmp"); collapseImage.MakeTransparent(); if (DpiHelper.IsScalingRequired) { DpiHelper.ScaleBitmapLogicalToDevice(ref collapseImage); } InitializeComponent(); foreach( Control c in this.Controls ){ if( c.SupportsUseCompatibleTextRendering ){ c.UseCompatibleTextRenderingInt = ownerGrid.UseCompatibleTextRendering; } } pictureBox.Image = SystemIcons.Warning.ToBitmap(); detailsBtn.Text = " " + SR.GetString(SR.ExDlgShowDetails); details.AccessibleName = SR.GetString(SR.ExDlgDetailsText); okBtn.Text = SR.GetString(SR.ExDlgOk); cancelBtn.Text = SR.GetString(SR.ExDlgCancel); detailsBtn.Image = expandImage; }
//------------------------------------------------------------------------------------------------------------------ // Purpose: Class constructor //------------------------------------------------------------------------------------------------------------------ // Call to super / base class public clsInvaderBullet(int x, int y) : base(x, y, 12, 32) { // Load resource image(s) & remove background and thu a sprite is born bullet = GridcoinGalaza.Properties.Resources.enemyBullet; bullet.MakeTransparent(Color.White); }
//Width = -1 ничего не делать public void ImageConvert(Stream resp, int width) { //открываем картинку System.Drawing.Image imgBuf = System.Drawing.Image.FromStream(resp); //если в строке запроса параметр width=-1 то оставляем картинку без изменений if (width != -1) { //пропорциональная высота int height = imgBuf.Height * width / imgBuf.Width; //Создаем Bitmap с новыми размерами var imgOutput = new Bitmap(width, height); //Делает стандартно прозрачный цвет прозрачным для данного изображения Bitmap. imgOutput.MakeTransparent(Color.Black); //Graphics инкапсулирует поверхность рисования GDI+ // FromImage - создает новый объект Graphics из указанного рисунка Image. Graphics newGraphics = Graphics.FromImage(imgOutput); //Очищает указанную поверхность и заливает указанным цветом newGraphics.Clear(Color.FromArgb(0, 255, 255, 255)); //Задаем качество и метод сжатия и преобразования newGraphics.CompositingQuality = CompositingQuality.HighQuality; newGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic; //Рисует указанный обект в заданном месте newGraphics.DrawImage(imgBuf, 0, 0, width, height); //Вызывает принудительный запуск отложенных операций и немедленно возвращается newGraphics.Flush(); //Сохраняет данное изображение в указанный поток в указанном формате. resp.Position = 0; imgOutput.Save(resp, System.Drawing.Imaging.ImageFormat.Jpeg); resp.Position = 0; } else { }; }
static void Main(string[] args) { String timestamp = args[0]; //Console.WriteLine(timestamp); Bitmap p0 = new Bitmap(256*6, 256*6); Graphics g = Graphics.FromImage(p0); g.CompositingMode = CompositingMode.SourceCopy; for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { try { int x = 1648 + i; int y = 441 + j; Bitmap p1 = new Bitmap("data\\" + timestamp + "_" + x + "_" + y + ".png"); p1.MakeTransparent(); g.DrawImage(p1, new Point(i * 256, (6 - j) * 256)); } catch (Exception e) { } } } p0.Save("data\\"+timestamp+".png"); }
public static Icon Create(Bitmap bm) { bm.MakeTransparent(Color.White); IntPtr ich = bm.GetHicon(); return Icon.FromHandle(ich); }
public Node(int type,Point screenPos) { screenPosition = screenPos; float ratioX = (float)screenPosition.X / (float)AutomatsDesign.PICTURE_WIDTH ; centerPoint.X = AutomatsDesign.LOGICAL_SIZE.X * ratioX; float ratioY = (float)screenPosition.Y /(float)AutomatsDesign.PICTURE_HEIGHT ; centerPoint.Y = AutomatsDesign.LOGICAL_SIZE.Y * ratioY; try { System.Reflection.Assembly thisExe; thisExe = System.Reflection.Assembly.GetExecutingAssembly(); String imagePath=""; typeNode = type; switch (type) { case 0: imagePath = "Linquistics.Resources.state_begin.bmp"; break; case 1: imagePath = "Linquistics.Resources.state.bmp"; break; case 2: imagePath = "Linquistics.Resources.state_accepted.bmp"; break; } System.IO.Stream file = thisExe.GetManifestResourceStream(imagePath); statePicture = new Bitmap(file); statePicture.MakeTransparent(Color.FromArgb(240, 240, 240)); widthPict = (int)((float)AutomatsDesign.IMAGE_DIMENSION * ((float)statePicture.Width / (float)statePicture.Height)); radius = (int)(Math.Round(Math.Sqrt(Math.Pow((statePicture.Height / 2), 2) + Math.Pow((statePicture.Width / 2), 2)))) - 10; } catch(Exception ex) { } }
public async Task Execute(IntPtr windowHandle) { Bitmap bitmapFile = (Bitmap)Bitmap.FromFile(Name + ".png", true); bitmapFile.Save("cmp1.png"); bool match = false; for (int i = 0; i < 10; i++) { User32.PrintScreen(); await Task.Delay(500); System.Windows.Forms.IDataObject clipboardData = System.Windows.Forms.Clipboard.GetDataObject(); System.Drawing.Bitmap screenShot = (System.Drawing.Bitmap)clipboardData.GetData(System.Windows.Forms.DataFormats.Bitmap); screenShot.MakeTransparent(); screenShot.Save("cmp2.png"); if (CompareBitmapsFast(screenShot, bitmapFile)) { match = true; break; } Thread.Sleep(100); } if (!match) { throw new TestException(TestError.ScreenshotMismatch); } }
public static Image ScaleByPercent(Image imgPhoto, int Percent) { var nPercent = ((float)Percent / 100); var sourceWidth = imgPhoto.Width; var sourceHeight = imgPhoto.Height; var sourceX = 0; var sourceY = 0; var destX = 0; var destY = 0; var destWidth = (int)(sourceWidth * nPercent + 0.5); var destHeight = (int)(sourceHeight * nPercent + 0.5); var bmPhoto = new Bitmap(destWidth, destHeight, PixelFormat.Format32bppArgb); bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution); bmPhoto.MakeTransparent(); Graphics grPhoto = Graphics.FromImage(bmPhoto); grPhoto.Clear(Color.Transparent); grPhoto.SmoothingMode = SmoothingMode.HighQuality; grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic; grPhoto.DrawImage(imgPhoto, new Rectangle(destX, destY, destWidth, destHeight), new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel); grPhoto.Dispose(); return bmPhoto; }
public void FromBitmapCutting(Bitmap fullBmp, Color mark) { fullBmp.MakeTransparent(fullBmp.GetPixel(0, 0)); Bitmap[] vertPieces = fullBmp.SplitVerticalByCol0(mark); vertPieces = vertPieces.Select(b => b.TrimTrailingRight(Color.Transparent)).ToArray(); /* for (int i = 0; i < vertPieces.Length; ++i) vertPieces[i].Save("vertPiece" + i + ".png"); */ Head = new NineContent(); Head.FromBitmapCutting(vertPieces[0], mark); Side = new A1A2A3(); Side.FromBitmapCutting(vertPieces[1].SliceX(1).SplitHorizontaByRow0(Color.Red)[0], mark); Waist = new NineContent(); Waist.FromBitmapCutting(vertPieces[2], mark); FootCap = new ABC(); FootCap.FromBitmapCutting(vertPieces[3].SliceX(2), mark); FootStack = new ABC(); FootStack.FromBitmapCutting(vertPieces[4].SliceX(2), mark); }
private Bitmap ToRoundPic(Bitmap addd) { //保存图象 //string filename = addd;//如果不是png类型,须转换 System.Drawing.Bitmap ybitmap = addd;// new System.Drawing.Bitmap(filename); for (int y = 0; y < ybitmap.Width; y++) { for (int x = 0; x < ybitmap.Height; x++) { Color c = ybitmap.GetPixel(x, y); //int wagrb = Color.White.ToArgb(); if (c.R == 255 && c.G == 255 && 255 == c.B) { ybitmap.SetPixel(x, y, System.Drawing.Color.FromArgb(0, 255, 254, 254)); } if ((x - ybitmap.Width / 2) * (x - ybitmap.Width / 2) + (y - ybitmap.Width / 2) * (y - ybitmap.Width / 2) > ybitmap.Width / 2 * ybitmap.Width / 2) { ybitmap.SetPixel(x, y, System.Drawing.Color.FromArgb(0, Color.White)); } } } Graphics g = Graphics.FromImage(ybitmap); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawImage(ybitmap, new Point(0, 0)); g.DrawEllipse(new Pen(Color.LightBlue), 0, 0, ybitmap.Width, ybitmap.Width); g.Dispose(); ybitmap.MakeTransparent(Color.FromArgb(0, Color.White)); return(ybitmap); }
private static Bitmap ScaleBitmap(Bitmap image, int width, int height) { if (height == -1) { var scale = (double)image.Height / (double)image.Width; height = (int)Math.Ceiling(image.Height * ((double)width / (double)image.Width) * scale); } var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); // set the resolutions the same to avoid cropping due to resolution differences bmp.SetResolution(image.HorizontalResolution, image.VerticalResolution); //use a graphics object to draw the resized image into the bitmap using (Graphics graphics = Graphics.FromImage(bmp)) { //set the resize quality modes to high quality graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //draw the image into the target bitmap graphics.DrawImage(image, 0, 0, bmp.Width, bmp.Height); bmp.MakeTransparent(bmp.GetPixel(0, 0)); } //return the resulting bitmap return bmp; }
public MemoryStream savePng() { for (int j = 0; j < load; j++) for (int m = 0; m < drawnPointer[j].Count; m++) drawnPointer[j][m] = new Point(drawnPointer[j][m].X - min.X, drawnPointer[j][m].Y - min.Y); using (Bitmap bmp = new Bitmap(max.X - min.X, max.Y - min.Y)) { Rectangle test = new Rectangle(Point.Empty, bmp.Size); DrawToBitmap(bmp, test); bmp.MakeTransparent(Color.White); Image img = (Image)bmp; MemoryStream saveStream = new MemoryStream(); img.Save(saveStream, ImageFormat.Png); return saveStream; /*using (FileStream saveStream = new FileStream("test" + ".png", FileMode.OpenOrCreate)) { img = (Image)bmp; img.Save(saveStream, ImageFormat.Png); }*/ } }
public static Texture LoadTexture(string filename) { Bitmap bmp = new Bitmap(filename); bmp.MakeTransparent(Color.FromArgb(0, 255, 0)); Texture t; t.Bitmap = new bool[bmp.Width, bmp.Height]; t.Alpha = new bool[bmp.Width, bmp.Height]; for(int x = 0;x< bmp.Width; x++) { for (int y = 0; y < bmp.Height;y++) { Color p = bmp.GetPixel(x, y); if (p.A == 0) { t.Alpha[x,y] = false; } else { t.Alpha[x, y] = true; t.Bitmap[x, y] = (p == Color.Black); } } } return t; }
public clsPickups(int x, int y, int pickupType) : base(x, y, 0, 0) { //------------------------------------------------------------------------------------------------------------------ // Purpose: Class constructor //------------------------------------------------------------------------------------------------------------------ //:: Load resource image(s) & remove background and thu a sprite is born :: switch (pickupType) { case 0: pickup = GridcoinGalaza.Properties.Resources.pickupA; break; case 1: pickup = GridcoinGalaza.Properties.Resources.pickupB; break; case 2: pickup = GridcoinGalaza.Properties.Resources.pickupC; break; } // Remove background pickup.MakeTransparent(Color.Black); // Assign attributes this class this.pickupType = pickupType; // Apply width and height call to super base.setH(pickup.Height); base.setW(pickup.Width); }
public Splash() { InitializeComponent(); Bitmap b = new Bitmap(this.BackgroundImage); b.MakeTransparent(b.GetPixel(1, 1)); this.BackgroundImage = b; }
void _buttonDropB_ExecuteEvent(object sender, ExecuteEventArgs e) { List <int> supportedImageSizes = new List <int>() { 32, 48, 64 }; Bitmap bitmap; StringBuilder bitmapFileName = new StringBuilder(); int selectedImageSize; if (supportedImageSizes.Contains(SystemInformation.IconSize.Width)) { selectedImageSize = SystemInformation.IconSize.Width; } else { selectedImageSize = 32; } exitOn = !exitOn; string exitStatus = exitOn ? "on" : "off"; bitmapFileName.AppendFormat(@"..\..\Res\Exit{0}{1}.bmp", exitStatus, selectedImageSize); bitmap = new System.Drawing.Bitmap(bitmapFileName.ToString()); bitmap.MakeTransparent(); _buttonDropB.LargeImage = _ribbon.ConvertToUIImage(bitmap); }
public void OnCreate(object hook) { // TODO: Add CAddLayer.OnCreate implementation m_pApplication = hook as IApplication; m_pMxDoc = (IMxDocument)m_pApplication.Document; m_pMap = (IMap)m_pMxDoc.FocusMap; UID pUID = new UIDClass(); pUID.Value = "CoM_GISTools.CExtension"; m_pExtension = (IExtensionConfig)m_pApplication.FindExtensionByCLSID(pUID); //// testing //if (m_pExtension.State == esriExtensionState.esriESEnabled) // MessageBox.Show("CAddLayer::Enabled"); //else if (m_pExtension.State == esriExtensionState.esriESDisabled) // MessageBox.Show("CAddLayer::Disabled"); //else // MessageBox.Show("CAddLayer::Unavailable"); m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("CoM_GISTools.Images.addLayer.bmp")); //("CoM_GISTools.AddLayer.CAddLayer.bmp")); if (m_bitmap != null) { m_bitmap.MakeTransparent(m_bitmap.GetPixel(1, 1)); m_hBitmap = m_bitmap.GetHbitmap(); } }
public Form1() { InitializeComponent(); MaximizeBox = false; Bitmap stopBMP = new Bitmap(Properties.Resources.stop); stopBMP.MakeTransparent(); btnStop.Image = stopBMP; Bitmap zoomOutBMP = new Bitmap(Properties.Resources.zoom_out); zoomOutBMP.MakeTransparent(); btnZoomOut.Image = zoomOutBMP; Bitmap saveBMP = new Bitmap(Properties.Resources.save); saveBMP.MakeTransparent(); btnSave.Image = saveBMP; scrWidth = panel1.Width; scrHeight = panel1.Height; myGDIBuffer = new Bitmap(scrWidth, scrHeight, panel1.CreateGraphics()); translX = -scrHeight * 11 / 16;// moves to right slighty translY = -scrWidth / 2; this.zoom = INITIALZOOM; threadCount = 4;//Environment.ProcessorCount ; Go(panel1, threadCount); }
/// <summary> /// 将图像按指定的行和列进行切割,切割的图片存储到原图片目录的同名文件夹下 /// </summary> /// <param name="fileName"></param> /// <param name="rowCount"></param> /// <param name="colCount"></param> public static void SplitImageFile(string fileName, int rowCount, int colCount) { Image image = Image.FromFile(fileName); string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(fileName); string fileExtension = System.IO.Path.GetExtension(fileName); string fileDirectory = System.IO.Path.GetDirectoryName(fileName); int colWidth = image.Width / colCount; int rowHeight = image.Height / rowCount; int i = 0; for (int row = 0; row < rowCount; row++) { for (int col = 0; col < colCount; col++) { Bitmap newBmp = new Bitmap(colWidth, rowHeight, PixelFormat.Format24bppRgb); newBmp.MakeTransparent(); Graphics newBmpGraphics = Graphics.FromImage(newBmp); newBmpGraphics.Clear(Color.Transparent); newBmpGraphics.DrawImage(image, new Rectangle(0, 0, colWidth, rowHeight), new Rectangle(col * colWidth, row * rowHeight, colWidth, rowHeight), GraphicsUnit.Pixel); newBmpGraphics.Save(); string newDirectory = fileDirectory + "\\" + fileNameWithoutExtension; if (!Directory.Exists(newDirectory)) { Directory.CreateDirectory(newDirectory); } string newfileName = newDirectory + "\\" + fileNameWithoutExtension + "_" + i.ToString() + fileExtension; newBmp.Save(newfileName,ImageFormat.Png); i++; } } }
private int totalPoint; // le score du joueur #endregion Fields #region Constructors // constructeur, on recoit le panel, le point de départ dans le panel et si le joueur est le premier ou le deuxieme public Joueur(Panel panel, Point loc, bool j1) { pBJoueur = new PictureBox(); // on instencie le pB du joueur pBJoueur.Location = loc; // on place le joueur a la bonne position dans le panel pBJoueur.BackColor = Color.Transparent; // Astuce pour avoir un fond transparent avec un bitmap. La couleur de fond est transparente Bitmap vaisseau; if (j1) // Si c'est le joueur 1 alors il sera blanc. On choisi un pixel ( dans un des coins) dont la couleur correspondra au transparent { joueur1 = true; // variable pour les animations (pas avoir de changement de couleurs lors du changement d'image) vaisseau = new Bitmap(@".\vaisseau.bmp"); vaisseau.MakeTransparent((vaisseau.GetPixel(0, vaisseau.Size.Height - 1))); } // si c'est le joueur 2 else { joueur1 = false; vaisseau = new Bitmap(@".\vaisseau2.bmp"); vaisseau.MakeTransparent((vaisseau.GetPixel(0, vaisseau.Size.Height - 1))); } pBJoueur.Size = new Size(50, 50); // on donne la taille au pB pBJoueur.Image = vaisseau; // On donne au pB l'image pBJoueur.BringToFront(); // On met le pB au premier plan pour éviter des recouvrements this.panelFond = panel; // On met le panel recu dans une des variables pour éviter de devoir faire des envois intempestifs panelFond.Controls.Add(pBJoueur); // on ajoute le joueur au controle du panel (pour qu'on ne voie pas le gros carré noir) pBJoueur.Refresh(); // Pour etre certain que l'image est bien présente dans le pB totalPoint = 0; // on mets son score a 0 combo = 1000; // On rempli sa jauge de super tir }
public static Image ResizeImage(Image content, int size, bool sizeIsHeight) { int width; int height; if (sizeIsHeight) { height = size; width = content.Width * height / content.Height; } else { width = size; height = content.Height * width / content.Width; } var result = new Bitmap(width, height, PixelFormat.Format24bppRgb); result.SetResolution(content.HorizontalResolution, content.VerticalResolution); result.MakeTransparent(); using (var grPhoto = Graphics.FromImage(result)) { grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic; grPhoto.DrawImage(content, new Rectangle(-1, -1, width + 1, height + 1), new Rectangle(0, 0, content.Width, content.Height), GraphicsUnit.Pixel); } return result; }
private static System.Drawing.Image EmptyImage() { var img = new System.Drawing.Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb); img.MakeTransparent(); return(img); }
public Bitmap DrawNote(Bitmap stave, Bitmap note, Tone tone, int notePositionX) { int index = ToneGraph.GetReferenceToneIndex(tone); Bitmap newBitmap = new Bitmap(stave.Width, stave.Height); using (Graphics graphics = Graphics.FromImage(newBitmap)) { Rectangle ImageSize = new Rectangle(0, 0, stave.Width, stave.Height); graphics.FillRectangle(Brushes.White, ImageSize); if (tone.ChromaticChange != 0) { DrawFlatSharpSymbol(newBitmap, tone, index, notePositionX); } graphics.DrawImage(note, new Point(notePositionX, this.LowestNotePositionY - (this.DistanceBetweenLines / 2) * index)); DrawLedgerLine(newBitmap, tone, index, notePositionX); graphics.CompositingMode = CompositingMode.SourceOver; stave.MakeTransparent(Color.White); graphics.DrawImage(stave, 0, 0); } return newBitmap; }
public CommunityToolWindow(IServiceProvider serviceProvider) : base(serviceProvider) { this.InitializeUserInterface(); Bitmap bitmap = new Bitmap(typeof(CommunityToolWindow), "Refresh.bmp"); bitmap.MakeTransparent(Color.Fuchsia); this._buttonImages.Images.Add(bitmap); this._refreshButton = new MxToolBarButton(); this._refreshButton.ToolTipText = "Refresh"; this._refreshButton.Enabled = false; this._refreshButton.ImageIndex = 0; MxToolBarButton button = new MxToolBarButton(); button.Style = ToolBarButtonStyle.Separator; this._toolBar.Buttons.Add(this._refreshButton); this._toolBar.Buttons.Add(button); this._tabs = new ArrayList(); ArrayList config = (ArrayList) ConfigurationSettings.GetConfig("microsoft.matrix/community"); if (config != null) { for (int i = 0; i < config.Count; i += 2) { string typeName = (string) config[i]; string initializationData = (string) config[i + 1]; try { CommunityTab tab = (CommunityTab) Activator.CreateInstance(System.Type.GetType(typeName, true, false)); tab.Initialize(serviceProvider, initializationData); this.AddTab(tab); } catch (Exception) { } } } }
public MultivariateRendPropPageCS() { //'MsgBox("New (color prop page)") m_Page = new PropPageForm(); m_Priority = 550; // 5th category is for multiple attribute renderers string[] res = typeof(MultivariateRendPropPageCS).Assembly.GetManifestResourceNames(); if (res.GetLength(0) > 0) { try { string bitmapResourceName = GetType().Name + ".bmp"; //creating a new bitmap m_bitmap = new Bitmap(GetType(), bitmapResourceName); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } if (m_bitmap != null) { m_bitmap.MakeTransparent(m_bitmap.GetPixel(1, 1)); m_hBitmap = m_bitmap.GetHbitmap(); } } }
public void AddBackGroundToPic(int width, int height, string picType, int destLength, string backPicURl) { bmpTemp = new Bitmap(destLength, destLength, PixelFormat.Format32bppArgb); bmpTemp.SetResolution(imgSource.HorizontalResolution, imgSource.VerticalResolution); bmpTemp.MakeTransparent(Color.White); // 建立Graphics对象,并设置主要属性 Graphics g = Graphics.FromImage(bmpTemp); try { g.Clear(Color.White); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.CompositingQuality = CompositingQuality.GammaCorrected; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; // 在画布上画图 //设置背景图片 g.DrawImage(Image.FromFile(backPicURl + picType + ".png"), 0, 0); g.DrawImage(imgSource, (destLength - Convert.ToSingle(width)) / 2, (destLength - Convert.ToSingle(height)) / 2, Convert.ToSingle(width), Convert.ToSingle(height)); imgSource.Dispose(); imgSource = (Image)bmpTemp.Clone(); } catch (Exception exp) { throw exp; } finally { g.Dispose(); bmpTemp.Dispose(); } }
private void SpinGlobe_Load(object sender, System.EventArgs e) { //Load command button images System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "browse.bmp")); bitmap.MakeTransparent(System.Drawing.Color.Teal); btnLoad.Image = bitmap; bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "spin_counterclockwise.bmp")); bitmap.MakeTransparent(System.Drawing.Color.Teal); btnAntiClockwise.Image = bitmap; bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "spin_clockwise.bmp")); bitmap.MakeTransparent(System.Drawing.Color.Teal); btnClockwise.Image = bitmap; bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "spin_stop.bmp")); bitmap.MakeTransparent(System.Drawing.Color.Teal); btnStop.Image = bitmap; //Set the current Slider value and timer interval to 100 milliseconds //Any faster and the Globe will not be able to refresh fast enough TrackBar1.Value = 100; timer1.Interval = 100; timer1.Enabled = false; i = 0; //Disable controls until doc is loaded btnAntiClockwise.Enabled = false; btnClockwise.Enabled = false; btnStop.Enabled = false; }
public Image ResizeImg(int newWidth, int newHeight, Image sourceImage) { int srcWidth = sourceImage.Width; int srcHeight = sourceImage.Height; System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(newWidth, newHeight); bitmap.MakeTransparent(); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap); graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; System.Drawing.Rectangle rectangleDestination = new System.Drawing.Rectangle(0, 0, newWidth, newHeight); graphics.DrawImage(sourceImage, rectangleDestination, 0, 0, srcWidth, srcHeight, System.Drawing.GraphicsUnit.Pixel); Stream destination = new MemoryStream(); bitmap.Save(destination, ImageFormat.Png); destination.Position = 0; bitmap.Dispose(); return(Image.FromStream(destination)); }
public PropertiesExplorer() { tabPages = new List <PropertyPage>(); listBox = new ListBox(); // a ListBox which only becomes visible (and positioned and filled) when a drop-down button of an PropertyEntry has been clicked listBox.Visible = false; listBox.LostFocus += ListBox_LostFocus; listBox.SelectedIndexChanged += ListBox_SelectedIndexChanged; listBox.MouseClick += ListBox_MouseClick; listBox.DrawMode = DrawMode.OwnerDrawFixed; listBox.Name = "the list box"; listBox.TabStop = false; listBox.DrawItem += ListBox_DrawItem; textBox = new TextBox(); textBox.Visible = false; textBox.KeyUp += TextBox_KeyUp; textBox.Name = "the text box"; textBox.TabStop = false; labelExtension = new Label(); labelExtension.Visible = false; labelExtension.Name = "the label extension"; labelExtension.TabStop = false; labelExtension.Paint += LabelExtension_Paint; tabControl = new TabControl(); tabControl.Dock = DockStyle.Fill; tabControl.Name = "the tab control"; tabControl.TabStop = false; // we have our own tab handling mechanism tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; tabControl.DrawMode = TabDrawMode.OwnerDrawFixed; tabControl.SizeMode = TabSizeMode.Fixed; tabControl.ItemSize = new Size(27, 21); tabControl.DrawItem += tabControl_DrawItem; tabControl.ShowToolTips = true; Controls.Add(tabControl); Controls.Add(listBox); Controls.Add(textBox); Controls.Add(labelExtension); ImageList imageList = new ImageList(); imageList.ImageSize = new Size(16, 16); System.Drawing.Bitmap bmp = BitmapTable.GetBitmap("Icons.bmp"); Color clr = bmp.GetPixel(0, 0); if (clr.A != 0) { bmp.MakeTransparent(clr); } imageList.Images.AddStrip(bmp); tabControl.ImageList = imageList; entriesToHide = new HashSet <string>(); }
public override System.Drawing.Bitmap GetNext() { if (this.newBitmap == null || this.newBitmap.PixelFormat == System.Drawing.Imaging.PixelFormat.Undefined || this.oldBitmap == null || this.oldBitmap.PixelFormat == System.Drawing.Imaging.PixelFormat.Undefined) { return(new System.Drawing.Bitmap(8, 8)); } System.Drawing.Bitmap result; lock (this.newBitmap) { lock (this.oldBitmap) { if (this.nowState == MarqueeDisplayState.First) { this.nowPosition = (int)this.nowPositionF; int arg_84_0 = (this.newBitmap.Width - this.nowPosition) / 2; System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(this.oldBitmap); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap); this.GetLeft(this.nowPosition); System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Purple); System.Drawing.Bitmap bitmap2 = new System.Drawing.Bitmap(this.newBitmap); System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(bitmap2); graphics2.FillPolygon(solidBrush, this.pointLeft); bitmap2.MakeTransparent(System.Drawing.Color.Purple); graphics.DrawImage(bitmap2, new System.Drawing.Point(0, 0)); graphics2.Dispose(); solidBrush.Dispose(); bitmap2.Dispose(); graphics.Dispose(); this.nowPositionF -= this.step; if (this.nowPositionF <= 0f) { this.nowState = MarqueeDisplayState.Stay; } result = bitmap; } else if (this.nowState == MarqueeDisplayState.Stay) { this.StayNum += 42; if (this.StayNum > this.effect.Stay) { if (this.effect.ExitMode == 0) { result = null; return(result); } this.nowState = MarqueeDisplayState.Exit; } result = new System.Drawing.Bitmap(this.newBitmap); } else { result = this.Exit.GetNext(); } } } return(result); }
public static System.Drawing.Bitmap Base64ToImage(string base64String) { Byte[] bitmapData = new Byte[base64String.Length]; bitmapData = Convert.FromBase64String(base64String); System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData); System.Drawing.Bitmap bitImage = new System.Drawing.Bitmap((System.Drawing.Bitmap)System.Drawing.Image.FromStream(streamBitmap)); bitImage.MakeTransparent(System.Drawing.Color.Black); return(bitImage); }
private void SplashScreenForm_Load(object sender, EventArgs e) { System.Drawing.Bitmap Img = (Bitmap)this.BackgroundImage; Color color = Img.GetPixel(0, 0); Img.MakeTransparent(color); this.BackgroundImage = Img; this.TransparencyKey = color; this.BackColor = color; }
void _buttonDropA_ExecuteEvent(object sender, ExecuteEventArgs e) { // load bitmap from file Bitmap bitmap = new System.Drawing.Bitmap(@"..\..\Res\Drop32.bmp"); bitmap.MakeTransparent(); // set large image property _buttonDropA.LargeImage = _ribbon.ConvertToUIImage(bitmap); }
public clsPlayerBullet(int x, int y) : base(x, y, 48, 32) { //------------------------------------------------------------------------------------------------------------------ // Purpose: Class constructor //------------------------------------------------------------------------------------------------------------------ // Load resource image(s) & remove background and thu a sprite is born bullet = BlasterMaster.Properties.Resources.playerBullet; bullet.MakeTransparent(Color.White); }
private void SplashScreenForm_Load(object sender, EventArgs e) { //versionLabel.Text = new Version(Application.ProductVersion).Major + "." + new Version(Application.ProductVersion).Minor; System.Drawing.Bitmap Img = (Bitmap)this.BackgroundImage; Color color = Img.GetPixel(0, 0); Img.MakeTransparent(color); this.BackgroundImage = Img; this.TransparencyKey = color; this.BackColor = color; }
private void RefreshButtonUI() { if (this._toolButton != null) { System.Drawing.Bitmap bitmap = Image.FromHbitmap(new IntPtr(this.Bitmap)); bitmap.MakeTransparent(); this._toolButton.Image = bitmap; this._toolButton.ToolTipText = this.Tooltip; this._toolButton.Text = this.Caption; } }
public override System.Drawing.Bitmap GetNext() { System.Drawing.Bitmap result; lock (this.newBitmap) { lock (this.oldBitmap) { if (this.nowState == MarqueeDisplayState.First) { this.nowPosition = (int)(8f * this.nowPositionF); int arg_58_0 = (this.newBitmap.Width - this.nowPosition) / 2; System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(this.oldBitmap); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap); System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Silver, (float)(9 - this.nowPosition)); System.Drawing.Bitmap bitmap2 = new System.Drawing.Bitmap(this.newBitmap); System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(bitmap2); for (int i = 0; i < this.newBitmap.Height; i += 8) { graphics2.DrawLine(pen, new System.Drawing.Point(0, i + this.nowPosition), new System.Drawing.Point(this.newBitmap.Width, i + this.nowPosition)); } graphics2.Dispose(); bitmap2.MakeTransparent(System.Drawing.Color.Silver); graphics.DrawImage(bitmap2, new System.Drawing.Point(0, 0)); bitmap2.Dispose(); graphics.Dispose(); this.nowPositionF += this.step; if (this.nowPositionF >= 1f) { this.nowState = MarqueeDisplayState.Stay; } result = bitmap; } else if (this.nowState == MarqueeDisplayState.Stay) { this.StayNum += 42; if (this.StayNum > this.effect.Stay) { if (this.effect.ExitMode == 0) { result = null; return(result); } this.nowState = MarqueeDisplayState.Exit; } result = new System.Drawing.Bitmap(this.newBitmap); } else { result = this.Exit.GetNext(); } } } return(result); }
private void DocumentProperties_Load(object sender, System.EventArgs e) { System.Drawing.Bitmap bitmap1 = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "browse.bmp")); bitmap1.MakeTransparent(System.Drawing.Color.Teal); btnLoad.Image = bitmap1; System.Drawing.Bitmap bitmap2 = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "properti.bmp")); bitmap2.MakeTransparent(System.Drawing.Color.Teal); btnProperties.Image = bitmap2; btnGlobeProperties.Image = bitmap2; chkTOC.Enabled = false; }
public static BitmapImage ConvertBitmapToBitmapImage(System.Drawing.Bitmap b) { BitmapImage bmpimg = new BitmapImage(); System.IO.MemoryStream memStream = new System.IO.MemoryStream(); bmpimg.BeginInit(); b.MakeTransparent(System.Drawing.Color.White); b.Save(memStream, System.Drawing.Imaging.ImageFormat.Png); bmpimg.StreamSource = memStream; bmpimg.EndInit(); return(bmpimg); }
public Working() { InitializeComponent(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager("SharpPrivacyTray", System.Reflection.Assembly.GetExecutingAssembly()); this.Icon = (System.Drawing.Icon)resources.GetObject("iconWorking"); Application.DoEvents(); bmpWait.MakeTransparent(); AnimateImage(); }
public ReceiverConduit() : base() { System.Drawing.Bitmap RSbmp = Properties.Resources.Receiver_Selected; System.Drawing.Bitmap RUbmp = Properties.Resources.Receiver; RSbmp.MakeTransparent(System.Drawing.Color.Black); RUbmp.MakeTransparent(System.Drawing.Color.Black); RS = new DisplayBitmap(RSbmp); RU = new DisplayBitmap(RUbmp); Instance = this; }
public frmMonitor() { InitializeComponent(); System.Drawing.Bitmap Img = new System.Drawing.Bitmap("C:\\Users\\villaverde\\Desktop\\Kairos\\Cardiomed\\WCS Pulse\\SW\\WCS_Pulse\\WCS_Pulse\\Resources\\monitor_bg.bmp"); Img.MakeTransparent(Img.GetPixel(1, 1)); this.BackgroundImage = Img; this.TransparencyKey = Img.GetPixel(1, 1); fcMin = 0; fcMax = 0; fcMed = 0; }
/// <summary> /// Returns extracted icon as Texture2D Object /// </summary> /// <param name="path"></param> /// <param name="bSmall"></param> /// <returns></returns> public static Texture2D GetTextureFromIconatPath(string path, bool bSmall = false) { System.Drawing.Icon icon = GetIcon(path, bSmall); System.Drawing.Bitmap bitmap = icon.ToBitmap(); bitmap.MakeTransparent(); Texture2D texture = new Texture2D(bitmap.Width, bitmap.Height, TextureFormat.ARGB32, false); texture.LoadRawTextureData(Bitmap2RawBytes(bitmap)); texture.Apply(); return(texture); }
public System.Drawing.Bitmap get_image_of_file(string filename) { //create a new database instance and load the dwg file into it. Database dbb = new Database(false, true); dbb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, false, ""); //grab the thumbnail bitmap and get rid of the white background System.Drawing.Bitmap preview = dbb.ThumbnailBitmap; preview.MakeTransparent(System.Drawing.Color.White); return(preview); }
public System.Drawing.Bitmap GetLoginImage(Core.IRibbonControl control) { if (_imgLogin == null) { _imgLogin = Properties.Resources.login; _imgLogout = Properties.Resources.logout; _imgLogin.MakeTransparent(System.Drawing.Color.Magenta); _imgLogout.MakeTransparent(System.Drawing.Color.Magenta); } if (_commands == null || _commands.IsLoggedIn == false) { return(_imgLogin); } return(_imgLogout); }
private Bitmap CreateObjectBitmap() { float dpiX = 200F; float dpiY = 200F; Bitmap bm = new System.Drawing.Bitmap( Convert.ToInt32(r.ReportDefinition.PageWidth.Size / 2540F * dpiX), Convert.ToInt32(r.ReportDefinition.PageHeight.Size / 2540F * dpiY) ); bm.MakeTransparent(Color.White); bm.SetResolution(dpiX, dpiY); return(bm); }