Hello,
I am working on kind of drawing program but I have a problem with flickering while moving a mouse cursor while drawing a rubberband line. I hope you can help me to remove that flickering of line, here is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing...
I'm trying to render some text into a specific part of an image in a Web Forms app. The text will be user entered, so I want to vary the font size to make sure it fits within the bounding box.
I have code that was doing this fine on my proof-of-concept implementation, but I'm now trying it against the assets from the designer, which are...
I am embedding images into my assembly using .resx files. Upon runtime, I need to save the images into standalone files, restoring the original content. How can I extract the original file stream from an System.Drawing.Bitmap instance? I know I can create a stream using Bitmap.Save(), but this transcodes (and in effect - inflates) the im...
I'm coming from a Java background and trying to port a simple version of Conway's Game of Life that I wrote to C# in order to learn the language.
In Java, I drew my output by inheriting from JComponent and overriding paint(). My new canvas class then had an instance of the simulation's backend which it could read/manipulate. I was then...
Hi,
is there a way to draw mixed-formatted text in .Net 2.0? I'm looking for something similar to
System.Drawing.Graphics.DrawString()
My problem with this method is that it allows only one format style for the whole text. But I need to draw text that has different format styles (e.g. a part of the text shall be underlined, another p...
Hi guys
I'm developing a ASP.Net web handler that returns images making a in-memory System.Windows.Forms.Control and then exports the rendered control as a bitmap compressed to PNG, using the method DrawToBitmap(). The classes are fully working by now, except for a problem with the color assignment. By example, this is a Gauge generated...
I am trying to programatically create a bitmap with a specified font in ASP.Net. The idea is that the text, font name, size color etc. will be passed in from variables and a bitmap of the text using the font etc will be returned.
However, I have been finding that I am only able to do so using the following code with certain fonts.
<...
I have the following .ashx page that takes some query string parameters and returns a bitmap with the specified text written on it.
The problem I have is that I am currently just manually setting the initial size of the bitmap at 100 X 100 when what I really want is to have the bitmap be just big enough to include all the text that was w...
In looking at the constructors for the System.Drawing.Font class there is a parameter to pass in one of the FontStyles defined in the System.Drawing.FontStyle enum.
ie.
Bold
Italic
Regular
Underline
and there are boolean properties for Bold, Italic, Underline etc. in the instantiated object, but they are read only.
Wh...
I have this code;
public static Image AddText(this Image image, ImageText text)
{
Graphics surface = Graphics.FromImage(image);
Font font = new Font("Tahoma", 10);
System.Drawing.SolidBrush brush = new SolidBrush(Color.Red);
surface.DrawString(text.Text, font, brush, new PointF { X = 30, Y = 10 ...
Hi guys, I am making a image editor kinda for own enjoyment and was wondering how could I make a undo button to undo the last paints I did? I want to know how I would about this, a tutorial or sample code would be nice or at least something pointing me in the right direction.
Thanks!
...
Hi, i simply want to load a .BMP file and get the Bitmap object in 24bit RGB format (or 32bit in RGB format).
All methods I tried return a Bitmap/Image object with PixelFormat = Format32bppArgb. Even if of course BMPs don't have alpha.
new Bitmap(System.Drawing.Image.FromFile(fileName, true));
new Bitmap(fileName);
I currently solve...
I'm trying to use System.Drawing.RotateFlipType in my settings file. This screenshot summarizes my problem:
Each of RotateFlipType values is doubled, and some are missing. If I try to use some of missing values (like Rotate180FlipX, through app.config) - it is simply ignored.
Using VS2008 with SP1, vb.net with framework 3.5 on windo...
I'm trying to rescale uploaded jpeg in asp.net
So I go:
Image original = Image.FromStream(myPostedFile.InputStream);
int w=original.Width, h=original.Height;
using(Graphics g = Graphics.FromImage(original))
{
g.ScaleTransform(0.5f, 0.5f); ... // e.g.
using (Bitmap done = new Bitmap(w, h, g))
{
done.Save( Server.MapPath(saveas), I...
Is is somehow possible to control letter spacing when using Graphics.DrawString? I cannot find any overload to DrawString or Font that would allow me to do so.
g.DrawString("MyString", new Font("Courier", 44, GraphicsUnit.Pixel), Brushes.Black, new PointF(262, 638));
By letter spacing I mean the distance between letters. W...
When rendering text into a bitmap, I find that text looks very bad when rendered on top of an area with non-opaque alpha. The problem is progressively worse as the underlying pixels become more transparent. If I had to guess I'd say that when underlying pixels are transparent, the text renderer draws any anti-aliased 'gray' pixels as sol...
Hi,
I'm new to winforms and have tried to track down an answer to the following with no luck ...
I have a panel in winforms and add to it a Rectangle that is wider than the panel itself. I've set the panel AutoScroll property to true however the panels horizontal scrollbar never appears. Why is this? And how do I get the scrollbar to sc...
I am creating a rounded rectangle GraphicsPath (see red outline image below), and then using this as a clip region both when drawing graphics, and as the Region of a Form.
Unfortunately, although the path looks good, it doesn't work well as a region (see solid black image below)
Is there a way that I can generate a clipping region fro...
From the documentation of Image.FromHbitmap() at http://msdn.microsoft.com/en-us/library/k061we7x%28VS.80%29.aspx :
The FromHbitmap method makes a copy of the GDI bitmap; so you can release the incoming GDI bitmap using the GDIDeleteObject method immediately after creating the new Image.
This pretty explicitly states that the bitm...
I'm doing a conversion from .jpg to .png in System.Drawing and one thing that I've found is that this conversion tends to make the resulting converted .png much larger than the .jpg original. Sometimes more than 10x larger after converting to .png.
Given that seems to always be the case (unless you know of a way around this), is there a...