picturebox

Resizing the form elements on resizing the form

女生的网名这么多〃 提交于 2019-12-13 02:27:54
问题 how to Resizing the Windows form elements on resizing the form? is there any way to set the width of picturebox, panel, etc 100% like CSS? suggest me some help for best practices of layout? When i resize the Windows form, I want that Image size also change when i resize the image. like Windows Picture Viewer 回答1: You would probably be okay with the Anchor property of the controls. http://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor(v=vs.71).aspx 回答2: You should look

PictureBox BackgroundImage Property C#

纵饮孤独 提交于 2019-12-13 02:15:05
问题 can someone please refresh me how I can programatically set the background image of a picture box? Thank you very much! 回答1: Picture Box have both Image and Background Image Property to set Background Image you have to set pictureBox1.BackgroundImage=your_Image; and for Image property pictureBox1.Image=your_Image; 回答2: PictureBox.Image --Update You need an image object. You can use the static function image.fromfile PictureBox.Image = Image.FromFile(Path) 来源: https://stackoverflow.com

PictureBox does not change its size

岁酱吖の 提交于 2019-12-13 01:33:07
问题 I have a PictureBox and a Button inside a Form . The PictureBox fill the Form and the SizeMode property is set to StretchImage . When i click the button I want to change the image size (bigger), and I want also that the scrollbars appear . So, I change the Size property of my PictureBox on the click event: pictureBox1.Size = new Size(800, 800); but this code does not have any effect. Why? I also tried to redraw the image itself (using GDI commands), but in this way the scrollbars do not

16 bit mouse click limit on picturebox

我的未来我决定 提交于 2019-12-13 00:35:15
问题 This is a C# question. I have a form. On the form I have a panel. On the panel I have a picture box with a very large scrollable bitmap (Y >> 32768). The picture box click event does not fire when the picture box Y is greater than 32767. I understand that mouse clicks are limited to 16 bits. Is there way to get a mouse click of the underlying panel so I can compute Y from the scroll bar positon and the y coordinate of the panel? 回答1: Did you try another approach, such as "downscale" the

pictureBox.Image.Save() in c# doesn't work

一曲冷凌霜 提交于 2019-12-12 23:37:36
问题 I don't understand this issue. Because this usually worked till now. This method is reaction on click for saving image on pictureBox which is called canvas. I load the Image on canvas and then do some edits. Then I want save the image. If I click on the printScreenButton before loading image it works, but when I load the image it stops working. Where could be the problem? private void printScreenButton_Click(object sender, EventArgs e) { canvas.Image.Save("name.png", System.Drawing.Imaging

Adding multiple pictureboxes to a form programmatically in vb.net

霸气de小男生 提交于 2019-12-12 22:53:37
问题 So I have written a short section of code to add 6 pictureboxes to a form in random locations. It adds each picturebox to a collection, then loops through the collection and adds them to the form control. The bizarre issue is that the code only works when I step through it line by line in debug mode. If I just compile and run the code then only 1 picturebox is added to the form, but if I step through the code line by line then all 6 pictureboxes are successfully added to the form in random

How to draw on Control so drawing doesn't disappear?

点点圈 提交于 2019-12-12 21:23:55
问题 I want to display graphic file in PictureBox I have: private void btnLoad_Click(object sender, EventArgs e) { if (dgOpenFile.ShowDialog() == DialogResult.OK) { Bitmap img = new Bitmap(dgOpenFile.FileName); picture.Width = img.Height; picture.Height = img.Height; g.DrawImage(img, 0f, 0f); } } That's g private void Form1_Load(object sender, EventArgs e) { g = picture.CreateGraphics(); } But when I move my Form outside the window my picture disappears. How can I prevent that? 回答1: You should do

Error : Object is currently in use elsewhere.

耗尽温柔 提交于 2019-12-12 19:59:53
问题 I have developed an application the continuous read image stream from a DSLR camera. while (!liveViewExit) { // Create a Memory Stream stream = new IntPtr(); // Get the bitmap image from the DSLR bmp = GetEvfImage(stream); if (bmp != null) { // Crop the image. picImage = (System.Drawing.Image)bmp.Clone(new Rectangle(10, 0, 492, 768), bmp.PixelFormat); try { if (picImage != null) this.picLiveView.Image = (System.Drawing.Image)picImage.Clone(); } catch (Exception ex) { Utility.HandleError(ex);

How to thread safe call to PictureBox.Image in c# , currently gives one of 3 errors

二次信任 提交于 2019-12-12 19:06:27
问题 I am using this PictureBox on a form, to this picture box I use the AForge Code. I pass the REFERENCE of the pictureBox into a webcam class I create that initializes the webcam and tells it where to draw its frames to....so it happily draws it frames... no problemo. But then certain times (when I want to do stuff with said image, if a chck box is clicked)...I start this timer using simple code: timer1.Enabled = true; this timer's interval is set to 33. So now its firing along and every time

Shuffle random picture from resources on button click

隐身守侯 提交于 2019-12-12 09:50:26
问题 I have 1 picture box, named studPic . What I want to get is, when I click "shuffle" button, to get random image from resources. private void button2_Click(object sender, EventArgs e) { ... } After research I've found following http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/38d36fa4-1f5f-43e9-80f6-3c9a4edc7705/ I'm newbie to C#.. Is there easier way to achieve this result? For example, without adding picture names? UPDATE List<string> pictureNames = new List<string>();