picturebox

Load an image from a url into a PictureBox

天大地大妈咪最大 提交于 2019-12-28 05:37:06
问题 I want to load an image into a PictureBox . This is the image I want to load: http://www.gravatar.com/avatar/6810d91caff032b202c50701dd3af745?d=identicon&r=PG How do I do this? 回答1: The inbuilt PictureBox.Load(string URL) Method "sets the ImageLocation to the specified URL and displays the image indicated." (Since .NetFramework 2) 回答2: Try this: var request = WebRequest.Create("http://www.gravatar.com/avatar/6810d91caff032b202c50701dd3af745?d=identicon&r=PG"); using (var response = request

how to draw drawings in picture box

断了今生、忘了曾经 提交于 2019-12-28 04:05:29
问题 draw pictures in picture Box on Mouse dragging using c# 回答1: Put a PictureBox on your form, and set its BackColor to White. Then add this code to your form (you have to actually hook up the Mouse events below, i.e. you can't just copy and paste this code into your form): private Point? _Previous = null; private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { _Previous = e.Location; pictureBox1_MouseMove(sender, e); } private void pictureBox1_MouseMove(object sender,

how to zoom in the image inside a scrollable panel in vb

寵の児 提交于 2019-12-25 19:36:47
问题 I have a scrollable panel with an image/picture box inside . I wanted to zoom in and zoom out the image without the buttons disappearing on the lower left of the panel. by the way, the image is in it's actual size. If I make it a scrollable panel that can be zoomed in and out, will i still be able to get the coordinates of the image by not using the coordinates of the screen but the coordinates of the actual image? Pls help me 回答1: I'm not sure what you mean by zoom in and zoom out the image

Copying variables from one picturebox to another without making them change with each other

岁酱吖の 提交于 2019-12-25 13:46:09
问题 I would like to copy a picturebox to another picturebox, but I do not want them to change with each other. PictureBox picbox1 = new PictureBox(); PictureBox picbox2 = picbox1; picbox1.Visible = false; //The problem here is that picbox2.Visible will also become false I would like to make picbox1 change without changing picbox2 .... How would I be able to do that? 回答1: Probably the best way to maintain clean code is to create an extension method, also note that your second picturebox is

Scratch Image on PictureBox C#

谁说我不能喝 提交于 2019-12-25 09:04:52
问题 I coded this to scratch image on picturebox. bool draw = false; int pX = -1; int pY = -1; Bitmap drawing; public Form1() { drawing = new Bitmap(transformedImage.Width, transformedImage.Height, transformedImage.CreateGraphics()); Graphics.FromImage(drawing).Clear(Color.Transparent); } private void transformedImage_MouseMove(object sender, MouseEventArgs e) { if (draw) { int penWidth = Convert.ToInt32(penWidthValue.Value); if(blackCheck.Checked == true) ///black pen { Graphics panel = Graphics

C# Moving PictureBox over other PictureBoxes with transparent background

ぃ、小莉子 提交于 2019-12-25 07:27:31
问题 My goal is to make checkers game , where user can move checkers on the board. The board I have made is from DataGridView class . Right now what am i doing is creating picture boxes for each checker with transparent background and when the user moves the selected checker i am setting him BringToFront. The problem is that the "transparent" effect is actually relative to parent control, and the parent of all checkers is the DataGridView. So the result is when there is 2 checkers overlapping

A Simple Panning PictureBox (Winforms)

大城市里の小女人 提交于 2019-12-25 05:36:13
问题 I want to implement a panning pictureBox in C# winforms. I have a panel on which the autoScroll property is set to true. Within the panel I have my pictureBox whose sizeMode is set to autoSize. On the pictureBox I am listening to mouse events like so: private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { dragging = true; start = new Point(e.Location.X + pictureBox1.Location.X, e.Location.Y + pictureBox1.Location.Y); } } private void

System.Drawing.Point operator error [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-25 04:00:15
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to make the + operator work while adding two Points to each other? my code position.Location = (e.Location + pic1.Location) - bild_posi.Location; error smth like: the operator "+" isnt compatible with "System.Drawing.Point + System.Drawing.Point" how can i fix this? 回答1: It Depends on how you want to add points together You could write a method called AddPoints and one called SubtractPoints such as private

Creating a image viewer window controll

主宰稳场 提交于 2019-12-25 03:38:34
问题 I am learning GDI+ and I am trying to make a display window with scroll bars (so I can only see part of the image at a time and I can scroll around it). I have read through the basics of GDI+ from several books but I have not found any good tutorials online or in books available to me about doing more advanced things like this. Any recommendations on guides or example code on how do do this? Here is what I have so far protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if

Reveal portions of an image behind another image

拥有回忆 提交于 2019-12-25 03:29:34
问题 I have a PictureBox where I display an image (Let's call it Image1). There's a second image (Image2) which needs to be revealed as the user hovers the Image1 with the mouse. I only need to reveal part of Image2 (a 10X10 pixel size box), not the whole image as the mouse moves. Both images are BMP. How can I accomplish this task? I would think using overlays? I display the Image1 in the picturebox and then I load the Image2 in memory, now I just need to display the portions of the Image2 over