gdi+

I want to remove padding from top and bottom from generated Image

旧时模样 提交于 2020-01-06 04:00:06
问题 I am generate image from specified text but there is some problem i facing with remove padding from top and bottom of generated image. I tried by changing string format while using DrawString but somehow i achieved to remove from left and right. private void button1_Click(object sender, EventArgs e) { Font font = new Font("Arial", 52, FontStyle.Regular); Image i = GetTextAsImage(textBox1.Text,400, font, Color.Black, Color.LightGray); i.Save("myImage.jpeg", ImageFormat.Jpeg); } private Image

C# - TabPage Color event

僤鯓⒐⒋嵵緔 提交于 2020-01-05 04:15:07
问题 C# certainly isn't my strong suit so I appreciate all the generous folk sharing their knowledge. I'm working with a Windows Form and I've read up on events and have found some excellent help on how to modify a TabControl so I can have an OnDraw event that will add some coloring to the tabs. The color of each tab is based upon the state of a connection variable: Current (green) Lost (red) Stale (yellow) The OnDraw event works excellent for updating the color of each tab, but that only occurs

Delphi GDI+ DrawString Transparent From Left and Right

落爺英雄遲暮 提交于 2020-01-05 03:31:54
问题 I have problem drawing text transparent from left and right like this example: Image1: What i have done so far: var linGrBrush: TGPLinearGradientBrush; Text : String; x, y : Single; Begin Graphics.Clear(0); linGrBrush := TGPLinearGradientBrush.Create(MakePoint(0, 0), MakePoint(300, 0), MakeColor(0, 0, 0, 0), MakeColor(255, 255, 0, 0)); linGrBrush.SetBlendTriangularShape(0.8); Text := 'Transparent Text From Left And Right'; x:= 0; y:= 0; Graphics.DrawString(Text, Length(Text), Font, MakePoint

Drawing “transparent” text via C# Graphics, but in a way that it turns the drawn text to be “missing” so it's transparent in the resulting image

纵然是瞬间 提交于 2020-01-05 02:52:25
问题 I am looking to draw a string on a DC (Graphics - I am using C#) - but I want the drawn text to be "deleted" from the image so that what's left is essentially a cut-out of the text. If I was to DrawString with a transparent brush obviously nothing would have happened. Is there a way of drawing something like that, or do I need to use 2 DCs and BitBlt with some combination of NOTs or XOR or whatever (I did similar things years ago, but was wondering if there's an easiery way)? 回答1: You could

Drawing “transparent” text via C# Graphics, but in a way that it turns the drawn text to be “missing” so it's transparent in the resulting image

*爱你&永不变心* 提交于 2020-01-05 02:52:06
问题 I am looking to draw a string on a DC (Graphics - I am using C#) - but I want the drawn text to be "deleted" from the image so that what's left is essentially a cut-out of the text. If I was to DrawString with a transparent brush obviously nothing would have happened. Is there a way of drawing something like that, or do I need to use 2 DCs and BitBlt with some combination of NOTs or XOR or whatever (I did similar things years ago, but was wondering if there's an easiery way)? 回答1: You could

Movable FrameControl in Picturebox not working as intended

牧云@^-^@ 提交于 2020-01-04 09:08:33
问题 I'm using the following code to add a movable Frame control to a picturebox and add a translucent background to the outer area of the frame.But the black translucent color is not appearing outside the frame as intended.It is supposed to fill up all the area outside the frame.On dragging the frame its producing the black area where its dragged. I'm using a picturebox with size mode set to Zoom . using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;

Creating a Dib by only specifying the size with GDI+ and DotNet

孤者浪人 提交于 2020-01-04 05:42:11
问题 I have just recently discovered the difference between different constructors in GDI+. Going: var bmp = new Bitmap(width, height, pixelFormat); creates a DDB (Device Dependent Bitmap) whereas: var bmp = new Bitmap(someFile); creates a DIB (Device Independent Bitmap). This is really not usually important, except when handling very large images (where a DDB will run out of memory, and run out of memory at different sizes depending on the machine and its video memory). I need to create a DIB

Easiest way to combine several PNG8 images in .NET

江枫思渺然 提交于 2020-01-03 17:36:34
问题 I'm trying to combine a bunch of 8-bit PNG images into a larger PNG image in C#. Oddly enough, this seems to be particularly difficult. Since Graphics does not support indexed color, you can't use that, so I tried building a non-indexed Bitmap (using Graphics) and converting that to indexed color bitmap. The conversion is fine, but I can't figure out how to set the palette of the output image. It defaults to some pre-defined palette which has little to do with what I'm looking for. So: Is

Converting GDI+ PixelFormat to WPF PixelFormat

泄露秘密 提交于 2020-01-03 07:28:17
问题 What is the best way to get the System.Windows.Media.PixelFormats value equivalent to a System.Drawing.Imaging.PixelFormat ? 回答1: This is a way of converting, so lets start here and see if someone can top this horrendeous contraption. They map well to eachother, so writing the switch cases should be fairly easy. private static System.Windows.Media.PixelFormat ConvertPixelFormat(System.Drawing.Imaging.PixelFormat sourceFormat) { switch (sourceFormat) { case System.Drawing.Imaging.PixelFormat

How to convert an opencv mat image to gdi bitmap

与世无争的帅哥 提交于 2020-01-03 06:22:12
问题 I want to convert an openCV Mat file into a GDI+ BitMap image. I cannot find any information on how to do this? I think there is no straight way of doing this, but I hope that it is not involved of writing it to a file and reading back (http://opencv-users.1802565.n2.nabble.com/Convert-IplImage-to-Bitmap-td3784378.html ) I need to write something such as this: #include <windows.h> #include <gdiplus.h> #include <stdio.h> using namespace Gdiplus; Bitmap GetBitMap(cv::Mat inputImage) { Bitmap