picturebox

C# Panel.BackgroundImage + transparent Controls = flickering?

十年热恋 提交于 2019-12-04 20:57:08
I've got a Panel with a jpg BackgroundImage (with BackgroundImageLayout = Stretch ). On the panel it's Controls I add some PictureBoxes with a PNG which has transparent borders. Displaying this doesn't give any problems, but moving (the boxes are draggable) the PictureBoxes does. The result is that the moving PictureBox "disturbs" the BackgroundImage and slows down performance. The faster I drag the box, the more it disturbs the BackgroundImage , and vice versa. How to solve this problem? Giorgi Double buffering should help. Check this out: http://msdn.microsoft.com/en-us/library/b367a457.aspx

How to convert image to puzzle? [closed]

我的未来我决定 提交于 2019-12-04 19:32:29
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 last year . I Want the program get a pic of user ,then convert image to puzzle (for example 100 piece) then make 100 picture box. I using this following code for 4 and 9 piece. if (Image_Num.SelectedIndex == 0) { PB = new PictureBox[4]; int W, H; var imgarray = new Image[4]; var img = User_Image.Image; W = img.Width / 2; H = img.Height / 2; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2;

Add a Label over Picturebox

扶醉桌前 提交于 2019-12-04 17:54:21
I am trying to write some text over my picturebox so I thought the easiest and best thing to do is draw label over it. This is what I did: PB = new PictureBox(); PB.Image = Properties.Resources.Image; PB.BackColor = Color.Transparent; PB.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; PB.Size = new System.Drawing.Size(120, 30); PB.Location = new System.Drawing.Point(100, 100); lblPB.Parent = PB; lblPB.BackColor = Color.Transparent; lblPB.Text = "Text"; Controls.AddRange(new System.Windows.Forms.Control[] { this.PB }); I get blank page with no PictureBoxes. What am I doing

Stream from IP cam C#

霸气de小男生 提交于 2019-12-04 13:53:26
I have the following code which isn't working. My camUrl link works if I load into Firefox and streams from my cam, but nothing is displayed in my picturebox at runtime. Any ideas why? public Thread _camThread; private string camUrl = "http://my-domain-ip:2080/videostream.cgi?user=admin&pwd=password"; public HttpWebRequest webReq; public WebResponse webRes; public Stream sr; private void btnStart_Click(object sender, EventArgs e) { if (_camThread == null) _camThread = new Thread(new ThreadStart(RunCam)); _camThread.Start(); } private void RunCam() { try { webReq = (HttpWebRequest)WebRequest

How to display a PictureBox from behind code in C#

落爺英雄遲暮 提交于 2019-12-04 10:25:57
I know my question sounds basic, but i searched all over the place and found nothing.. this is my code : public MainWindow() { InitializeComponent(); Map newMap = new Map(); newMap.setMapStrategy(new SmallMapStrategy()); newMap.createMap(); System.Windows.Forms.PictureBox pictureBox1 = new System.Windows.Forms.PictureBox(); pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(newMap.grid[3].afficher); } this is the afficher function : public override void afficher(object sender, PaintEventArgs e) { e.Graphics.DrawImage(squareImage, pos_x, pos_y, 50, 50); } squareImage is an

Get PixelValue when click on a picturebox

浪子不回头ぞ 提交于 2019-12-04 09:51:45
I'm working on a .NET C# project and would like to get the pixel value when I click a picturebox, how can I achieve that? The basic idea is that when I click anywhere in the picturebox, I get the pixelvalue of that image point.. Thanks! Use this: private void pictureBox2_MouseUp(object sender, MouseEventArgs e) { Bitmap b = new Bitmap(pictureBox1.Image); Color color = b.GetPixel(e.X, e.Y); } As @Hans pointed out Bitmap.GetPixel should work unless you have different SizeMode than PictureBoxSizeMode.Normal or PictureBoxSizeMode.AutoSize . To make it work all the time let's access private

GIF Animation not working in Windows Form

隐身守侯 提交于 2019-12-04 07:10:25
I have 2 WinForms Form2 uses Infragistics ultraTabControl. On Tab Changing im Showing Form1. In Form1 I have a PictureBox assigned with animated GIF In Form2 I am displaying Form1 like this. Form1 frmOne=new Form1(); frmOne.Show(); Problem GIF is not playing animation. Make sure you have your image in the image property NOT THE BACKGROUND IMAGE PROPERTY . That's the mistake I made Niranjan Singh It is working fine for me. I have just dragged a new pictureBox on form and setting image property at Form_Load() event and showing GIF animated. I did same as you on button click: TestForms.NavBarTest

Toggling Picture Box visibility C#

时光怂恿深爱的人放手 提交于 2019-12-04 06:22:14
问题 Why is the picture box control's visibility property not working here. I have initially set them to false, so that when the screen loads they are not visible. But then I wish to toggle this. I have done the following but does not seem to work. This is a windows forms application. private void Action() { while (true) { Random r1 = new Random(); int num = r1.Next(1,3); switch (num) { case 1: pictureBoxLeft.Visible = true; pictureBoxRight.Visible = true; break; case 2: pictureBoxLeft.Visible =

Transparent Control on Transparent control?

試著忘記壹切 提交于 2019-12-04 05:59:32
问题 I created a TransparentTableLayoutPanel: class TransTablePanel : TableLayoutPanel { public TransTablePanel() { } protected override CreateParams CreateParams { get { CreateParams createParams = base.CreateParams; createParams.ExStyle |= 0x00000020; // WS_EX_TRANSPARENT return createParams; } } protected override void OnPaintBackground(PaintEventArgs e) { // Do not paint background. } } And a transparent PictureBox (I tried just using BackColor = Transparent and it didn't work) class

add on click event to picturebox vb.net

末鹿安然 提交于 2019-12-04 03:47:29
问题 I have a flowLayoutPanel which I am programatically adding new panelLayouts to. Each panelLayout has a pictureBox within it. It's all working nicely, but I need to detect when that picture box is clicked on. How do I add an event to the picture? I seem to only be able to find c# examples.... my code to add the image is as follows... ' add pic to the little panel container Dim pic As New PictureBox() pic.Size = New Size(cover_width, cover_height) pic.Location = New Point(10, 0) pic.Image =