gdi+

Create image with transparent background using GDI+?

安稳与你 提交于 2019-12-12 07:39:45
问题 I'm trying to create an image with a transparent background to display on a web page. I've tried several techniques but the background is always black. How can I create a transparent image and then draw some lines on it ? 回答1: Call Graphics.Clear(Color.Transparent) to, well, clear the image. Don't forget to create it with a pixel format that has an alpha channel, e.g. PixelFormat.Format32bppArgb . Like this: var image = new Bitmap(135, 135, PixelFormat.Format32bppArgb); using (var g =

.NET PowerPacks RectangleShape flickers on form resize

自古美人都是妖i 提交于 2019-12-12 06:23:37
问题 I can do something as simple as: Create a new .NET form application Put a single RectangleShape onto the form add the following into the InitializeComponent method in the designer code Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or _ ControlStyles.UserPaint Or _ ControlStyles.DoubleBuffer, True) Me.UpdateStyles() Run the program Resize the form Watch angrily as the rectangle flickers Is it possible to get rid of this? Or is the ShapeContainer internally flawed and I need to find a

GDI+ erroneous drawing under Windows explorer window

痴心易碎 提交于 2019-12-12 04:06:32
问题 I am using GDI* plus to do custom drawing, but I have a drawing error when my window gets drawn under a windows explorer window, it looks like this: As u can see just under the explorer window.. the colors are weird.. the top right are buttons and the checkbox is also a button .. "Are you.." is a static control.. they are all inherited and implemented as custom controls.. when receiving WM_PAINT. I also use a buffered image in WM_PAINT.. anyway.. I can't explain this, any ideas? It works fine

Does Gdiplus::Bitmap::FromHICON handle “black and white icon” properly?

丶灬走出姿态 提交于 2019-12-12 04:04:52
问题 As stated in MSDN ICONINFO, depending on whether the structure defines a black and white icon, the hbmMask and hbmColor are formatted differently. hbmMask Type: HBITMAP The icon bitmask bitmap. If this structure defines a black and white icon, this bitmask is formatted so that the upper half is the icon AND bitmask and the lower half is the icon XOR bitmask. Under this condition, the height should be an even multiple of two . If this structure defines a color icon, this mask only defines the

JPEG Compression causes GDI+ Exception

只愿长相守 提交于 2019-12-12 03:54:50
问题 So, I'm currently working on a LAN-Video-Streaming program, which records single images and sends them over. Because it would be too much to send 30 1920x1080 pictures per second, to get 30FPS, I did some research and found JPEG-Compression. The problem is, that when I try to save the compressed JPEG, it throws an System.Runtime.InteropServices.ExternalException , with the additional information: General error in GDI+. Here's my code: Private Sub Stream() Handles StreamTimer.Tick If Streaming

Delphi/C++Builder TBitmap: How to determinine scanline order?

…衆ロ難τιáo~ 提交于 2019-12-12 03:48:48
问题 Delphi's TBitmap type is basically a wrapper over a GDI BITMAP and PALETTE, and can support both top-down and bottom-up scanline ordering. I have a TBitmap which I need to convert to GDI+ Bitmap, in order to rotate and composite it. My bitmap is 32-bit ARGB, which windows supports, but VCL doesn't natively 'understand'. TBitmap *bmp; ... When I use the following constructor, the alpha channel doesn't work for compositing, but otherwise everything works. Gdiplus::Bitmap b(bmp->Handle, NULL);

Scrolling GDI pixels in Panel control

为君一笑 提交于 2019-12-12 03:38:44
问题 How do we make a Panel control scroll whatever's inside of it? I'm not talking about controls or user controls or custom controls. I'm talking only about pixels; drawn with GDI+: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace GDITEST { public partial class Form1 : Form { public class Item { public int Height { get; set

How to return a GDI::Bitmap from a function

馋奶兔 提交于 2019-12-12 01:45:34
问题 How can I return a bitmap from a function? This code doesn't work: Compiler error Gdiplus::Bitmap create() { Gdiplus::Bitmap bitmap(10,10,PixelFormat32bppRGB); // fill image return bitmap; } I don't want to return a pointer as then it generate a chance for memory leak. (or if there is way to avoid this chance of memory leak) 回答1: When you return an object from a function, the compiler needs to generate code to either copy or (in C++11) move that object. Gdiplus::Bitmap does not have an

Setting image palette throws GDI+ generic error exception if the image doesn't have a stream

淺唱寂寞╮ 提交于 2019-12-12 01:08:16
问题 I'm using GDI+ to render a few images onto a bitmap, then render the bitmap onto a panel to use as an editor. When an image in the editor panel is selected, it should highlight red. I had this working using the following code If mCurrentindex = ind Then Dim redImage As Bitmap = item.Image.Clone() Dim pal As ColorPalette pal = redImage.Palette For i As Integer = 0 To pal.Entries.Length - 1 If pal.Entries(i).Name = "ff000000" Then pal.Entries(i) = Color.Red End If Next redImage.Palette = pal g

How to force graphic to be redrawn with the invalidate method

霸气de小男生 提交于 2019-12-11 22:22:36
问题 I am struggling with getting the graphic to be redrawn with the invalidate method when the form goes the screen the graphic isn't redrawn i have tried to create an image from the graphics for it to been redrawn with the invalidate method but it doesn't work could somebody help edit the code for and do it in simple terms as i am still a beginner thanks would be much appreciated private void squareButton_Click(object sender, EventArgs e) { // Declaring a new graphics object has been assigned