gdi+

Need Help Setting an Image with Transparent Background to Clipboard

江枫思渺然 提交于 2019-12-07 02:43:00
问题 I need help setting a transparent image to the clipboard. I keep getting "handle is invalid". Basically, I need a "second set of eyes" to look over the following code. (The complete working project at ftp://missico.net/ImageVisualizer.zip.) This is an image Debug Visualizer class library, but I made the included project to run as an executable for testing. (Note that window is a toolbox window and show in taskbar is set to false.) I was tired of having to perform a screen capture on the

C# Setting FontDialog to only display TrueType fonts

早过忘川 提交于 2019-12-07 00:34:59
问题 This question has been asked in practically every forum, including here but there are no acceptable answers anywhere that I can find. I'm beginning to think that there is actually no solution and I just have to wrap my code in a try/catch block and apologise to the user and ask them to pick another font. I want to show a FontDialog so that a user can change the fonts on a Chart , however if the user selects a non-TrueType font, then an exception is thrown. GDI+ can only handle TrueType fonts.

myBitmap.RawFormat is something different than any known ImageFormat?

只愿长相守 提交于 2019-12-06 19:10:45
问题 I'm working with GDI+ and I create a new bitmap like this: var bmp = new Bitmap(width, height); now when I observe its RawFormat.Guid I see that it is different from all predefined ImageFormats (while I expect it to be JPEG). ImageFormat.Jpeg.Guid {b96b3cae-0728-11d3-9d7b-0000f81ef32e} format.Guid {b96b3caa-0728-11d3-9d7b-0000f81ef32e} Interesting part is that as you can see they are identical except one character which makes me even more confused. Any idea why? Which parts of code determines

C# winforms: How to change DPI of the System.Drawing.BItmap?

荒凉一梦 提交于 2019-12-06 18:56:51
问题 I need to change the DPI of the System.Drawing.Bitmap object from the default value = 96 to e.g. 150. I couldn't find the answer how to do that so I ask here :) 回答1: Bitmap result = new Bitmap(width, height); result.SetResolution(dpi, dpi); 来源: https://stackoverflow.com/questions/2682292/c-sharp-winforms-how-to-change-dpi-of-the-system-drawing-bitmap

Optimize drawing for paint application c#

江枫思渺然 提交于 2019-12-06 16:49:18
I am making a paint project like photoshop using c#. I have used GDI+ for the drawing. Sadly I cannot post the screen shot cuz of the reputation points required. EDIT : Ok i got enough rep to upload a pic. My drawing using the mouse lags when the brush size increases. I have a canvasBuffer which is drawn to the canvas panel protected override void OnPaint(PaintEventArgs e) { if (canvasBuffer != null) { using (Graphics g = e.Graphics) { g.DrawImage(canvasBuffer, e.ClipRectangle, e.ClipRectangle, GraphicsUnit.Pixel); } } } And this is what happens when any painting is done. I store the list of

Writing/Drawing my own ListBox/ListView Control from scratch

痞子三分冷 提交于 2019-12-06 15:06:24
问题 How would I go about finding out how a Windows Forms Control was made? I want to create a Control from scratch. Preferably a ListBox or even better, a ListView Control , but I have no idea where to start. Some suggestions I've come across in the past have been: Use a Panel Control and dynamically add Label controls to it with appropriate styling, and; Extend or Subclass the ListView / ListBox Control s, and set OwnerDraw to true , and do your custom drawing in the OnPaint event. But I want

Convert the Font size in inch

大城市里の小女人 提交于 2019-12-06 14:14:17
I need to convert between Drawing.Font.Size (float, ?) and WPF FontSize (double, WPF pixels). Finally, I decided to store in the database the fontSize in inch... How can I convert the GDI FontSize to inch and the WPF FontSize to inch? sizeInInch = wpfFontSize / 96 sizeInInch = gdiFontSize / ? Can I use something DPI independent? Maybe System.Windows.FontSizeConverter ? I need to convert to something, that will allow me to switch multiple time between WPF and GDI without changing the "real value". Each division and following multiplication will accumulate errors... FontSizeConverter does a

Draw border just inside non-transparent portion of image

浪尽此生 提交于 2019-12-06 14:08:00
问题 this thread is almost what I need: Creating a GraphicsPath from a semi-transparent bitmap but he is drawing an outline AROUND the image - I need to draw one just a couple of pixels INSIDE the image. basically I'm trying to draw a "Focus Rectangle" (except it's not a rectangle) the result needs to be in the form of a GraphicsPath so i can fit it right into my current code. private function GetImagePath(img as Image) as GraphicsPath ... end function [EDIT] ok, first of all i cant even get the

How to generate dynamic C# images? [closed]

南笙酒味 提交于 2019-12-06 14:06:18
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Basically, I want to rehash VisualCube , written previously in PHP. I've looked into GDI+, tried to find books that dealt with C#, graphics, etc. Everything somewhat relevant is aimed at only WinForms or WPF, while I'd ideally want to create a WebAPI or WCF service that serves up the images. What technologies can I use for this? If GDI+, can someone provide me a usage in WebAPI/WCF? I'd be accessing the WebAPI

Fade an image using GDI+ (i.e. Change only the Alpha channel of a TGPGraphic)

谁说胖子不能爱 提交于 2019-12-06 14:02:24
问题 I need to fade the right side of an image using GDI+. I'm actually trying to emulate the right hand side text fade that you see in Google Chrome. Here's what I want to do. Create a TGPGraphics object from a TBitmap . Create a TGPBitmap from a region of the TBitmap . Paint the background of the TGPGraphics object and the text to the TGPBitmap . Change the Alpha settings on the right hand side of the TGPBitmap object to produce the fade effect. Draw the TGPBitmap back to the TGPGraphics object.