Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My knowledge is stored in sql server eg a sample of the data in the list view show like this, I wrote:
item.SubItems.Add(dr["Fname"].ToString ());
A statement that I wrote when I was on the field list, click on the text box was shown Vaio example:
Vfname.Text = e.Item.SubItems[1].Text;
It is not clear what you are trying to do, but I assume you should add Image objects to your List View, using System.Drawing.Image.FromFile(), then draw them calling Graphics.DrawImage, passing the image file you have in the listview.
http://msdn.microsoft.com/en-us/library/42807xh1(v=vs.110).aspx
Image newImage = Image.FromFile("SampImag.jpg");
// Create Point for upper-left corner of image.
Point ulCorner = new Point(100, 100);
// Draw image to screen.
e.Graphics.DrawImage(newImage, ulCorner);
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Let me show you an example of what I would like to get:
Some of the labels are "normal" , other labels are not filled 100%.
To achieve that maybe the label control is not the best item to begin with, but I can't think of a better one. Any idea kind people?
You have to use paint for this first create a custom label
class HalfColorLabel:Label
{
protected override void OnPaint(PaintEventArgs e)
{
SolidBrush brush = new SolidBrush(Color.Orange);
Graphics g = e.Graphics;
g.FillRectangle(brush,new Rectangle(0,0,this.Width,this.Height/2));
base.OnPaint(e);
}
}
rebuild the solution
pick the halfcoloured label
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a List of objects and i want to create a Foreach loop which create images on my MainWindow separated by 50 pixels for example. I don't know if I have to create them in the desgner itself or if there's a way to create then place the images the one below the other in a command.
For example i have:
List<string> URIS = new List<string>();
foreach (var i in URIS)
{
//New image in MainWindow with source i
}
Remember that I want a "list" of images in my Window so that every image is below the last one.
Look into the ItemsControl. It has an ItemsSource property that takes a list and lays out its items into a visual list. You can use the ItemTemplate property to control exactly what type of visual is created from each list item, including things like spacing.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have used html5 camera capture attribute, when user try to capture image from the devices image gets rotated
Do we need to provide any setting on this?
Can we correct the image rotation using C#?
We are successfully using the following code to capture images and it works fine:
var canvas = document.getElementById("canvas")
var video = document.getElementById("video")
// Start video code omitted...
// Capture function
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext("2d").drawImage(video, 0, 0);
var imgData = canvas.toDataURL("image/jpeg")
The image should be fine unless there is some specific hardware configuration not allowing this.
And yes, it is possible to rotate the image using C#. Google it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm currently working on an application, to automate the generation of tilesets.
Actually my question is fairly simple.
I'm having trouble with seperating the file into tiles.
Is it possible to create seperate images out of a PictureBox or is there another, more effective way?
I want to cut the graphic into tiles, to rearrange them.
You can get a sub-image from a PictureBox relatively easily is the image is just a bitmap. You can use the bitmap classes Clone() method, which takes a Rectangle and PixelFormat.
Bitmap image = pictureBox.Image;
Bitmap subImage = image.Clone(new Rect(0,0,64,64), image.PixelFormat);
The subimage in this case would start at position (0,0) in the image and by 64x64 in size
In order to rearrange your tiles you can print them back onto the PictureBox like so:
Graphics g = Graphics.FromImage(image);
g.drawImage(subImage, 64, 64);
pictureBox.Image = image;
This will draw subImage into the image at (64,64) we grabbed from the picturebox, image, earlier and then set the PictureBox image to the edited one.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm developing game in which I choose picture from the gallery and then what I need to do is cut it into 12 custom shape part which will be used then as a puzzle I need those 12 piece to merge together and create the same.
Edit: To those who don't understand the question what i'm trying to accomplish is trying to split an single image into different part and then player will figure out the sequence of part and make the image.
I want the player to add the picture from his/her collection to make it more challenging and challenge others player.
A picture will make it more clear but as I don't have enough credit and i'm getting -ve one in this i don't know how to put it more clearly in the reader mind.
A possiblilty for which you are looking for is masking feature of UI components. You can deal with the flag Show mask graphics to show/hide the relative parts.
You can use Graphics.DrawImage to draw a cropped image onto the graphics object from a bitmap.
Rectangle cropRect = new Rectangle(...);
Bitmap src = Image.FromFile(fileName) as Bitmap;
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using(Graphics g = Graphics.FromImage(target))
{
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
}