当前位置: 首页>>代码示例>>C#>>正文


C# Forms.PictureBox类代码示例

本文整理汇总了C#中System.Windows.Forms.PictureBox的典型用法代码示例。如果您正苦于以下问题:C# PictureBox类的具体用法?C# PictureBox怎么用?C# PictureBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PictureBox类属于System.Windows.Forms命名空间,在下文中一共展示了PictureBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NotificationPanel

 /// <summary>
 /// Creates a new control instance.
 /// </summary>
 public NotificationPanel()
 {
     this.progressBar = new ProgressBar();
     this.labelProgress = new Label();
     this.pictureProgress = new PictureBox();
     ((System.ComponentModel.ISupportInitialize)(this.pictureProgress)).BeginInit();
     this.SuspendLayout();
     // progressBar
     this.progressBar.Location = new Point(62, 40);
     this.progressBar.Size = new Size(730, 16);
     this.progressBar.TabIndex = 1;
     this.progressBar.Visible = false;
     // labelProgress
     this.labelProgress.Location = new Point(62, 8);
     this.labelProgress.Size = new Size(730, 29);
     this.labelProgress.TabIndex = 0;
     this.labelProgress.TextAlign = ContentAlignment.MiddleLeft;
     // pictureProgress
     this.pictureProgress.Location = new Point(8, 8);
     this.pictureProgress.Size = new Size(48, 48);
     this.pictureProgress.TabIndex = 3;
     this.pictureProgress.TabStop = false;
     // Control.
     this.AutoScaleDimensions = new SizeF(6F, 13F);
     this.AutoScaleMode = AutoScaleMode.Font;
     this.Controls.Add(this.progressBar);
     this.Controls.Add(this.labelProgress);
     this.Controls.Add(this.pictureProgress);
     this.MaximumSize = new Size(0, 64);
     this.MinimumSize = new Size(0, 64);
     this.Size = new Size(800, 64);
     ((System.ComponentModel.ISupportInitialize)(this.pictureProgress)).EndInit();
     this.ResumeLayout(false);
 }
开发者ID:alexbikfalvi,项目名称:DotNetApi,代码行数:37,代码来源:NotificationPanel.cs

示例2: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.StartupPanel = new System.Windows.Forms.Panel();
     this.OdeoLogo = new System.Windows.Forms.PictureBox();
     this.ProgressMeter = new System.Windows.Forms.ProgressBar();
     //
     // StartupPanel
     //
     this.StartupPanel.Controls.Add(this.ProgressMeter);
     this.StartupPanel.Controls.Add(this.OdeoLogo);
     this.StartupPanel.Location = new System.Drawing.Point(0, 3);
     this.StartupPanel.Size = new System.Drawing.Size(176, 194);
     //
     // OdeoLogo
     //
     this.OdeoLogo.Location = new System.Drawing.Point(42, 49);
     this.OdeoLogo.Size = new System.Drawing.Size(92, 39);
     //
     // ProgressMeter
     //
     this.ProgressMeter.Location = new System.Drawing.Point(42, 94);
     this.ProgressMeter.Size = new System.Drawing.Size(92, 6);
     //
     // FrmStartup
     //
     this.ClientSize = new System.Drawing.Size(176, 200);
     this.Controls.Add(this.StartupPanel);
     this.Text = "Odeo Syncr";
 }
开发者ID:matthiase,项目名称:odeo-mobile,代码行数:33,代码来源:FrmStartup.cs

示例3: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            picboxes = new System.Windows.Forms.PictureBox[64];

            int px = 0, py=0;

            for (int i = 0; i < 64; ++i)
            {
                picboxes[i] = new System.Windows.Forms.PictureBox();
                picboxes[i].Width = 32;
                picboxes[i].Height = 32;
                picboxes[i].Left = px;
                picboxes[i].Top = py;

                picboxes[i].Click += new System.EventHandler(PicBoxClick);
                panel1.Controls.Add(picboxes[i]);

                px += 40;
                if (px >= 40 * 8)
                {
                    px = 0;
                    py += 40;
                }
            }

            colorize();
        }
开发者ID:suyashmohan,项目名称:colorize,代码行数:27,代码来源:Form1.cs

示例4: VideoRender

        public VideoRender(PictureBox view)
        {
            this.view = view;
			this.bufferContext = BufferedGraphicsManager.Current;
            this.foreground = new SolidBrush(Color.ForestGreen);
            this.background = new SolidBrush(Color.Black);
        }
开发者ID:fakeezz,项目名称:chip8.net,代码行数:7,代码来源:VideoRender.cs

示例5: AddSkyboxByDirectory

        public static void AddSkyboxByDirectory(string dir)
        {
            SRTSkybox skybox = new SRTSkybox();
            skybox.Name = Path.GetFileName(dir);

            IEnumerator<string> fileNameEnumerator = Directory.EnumerateFiles(dir, "*up.vmt").GetEnumerator();
            fileNameEnumerator.MoveNext();
            skybox.FileName = fileNameEnumerator.Current.Substring(0, fileNameEnumerator.Current.Length - 6);
            fileNameEnumerator.Dispose();

            string previewFileName = dir + "\\preview.png";

            if (File.Exists(previewFileName))
                skybox.PreviewImage = Image.FromFile(previewFileName);
            else if (File.Exists(vtfcmdPath))
                skybox.PreviewImage = GenerateSkyboxPreview(skybox, previewFileName);
            else if (File.Exists(previewFileName + ".old"))
                skybox.PreviewImage = Image.FromFile(previewFileName + ".old");
            else
                skybox.PreviewImage = GenerateDefaultSkyboxPreview(skybox, previewFileName + ".old");

            Skyboxes.Add(skybox);

            PictureBox pictureBox = new PictureBox();
            pictureBox.Size = new Size(600, 150);
            pictureBox.Image = skybox.PreviewImage;
            pictureBox.Margin = new Padding(0);
            pictureBox.Tag = skybox;
            pictureBox.Click += SkyboxForm.PictureBox_Click;

            SkyboxForm.FlowLayoutPanel.Controls.Add(pictureBox);
        }
开发者ID:Nofe92,项目名称:SourceRecordingTool,代码行数:32,代码来源:SRTSkybox.cs

示例6: VerifyPictureMaker

        //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡι��캯��
        public VerifyPictureMaker(int width, int height, PictureBox target)
        {
            m_obPic = new Bitmap(width, height, PixelFormat.Format24bppRgb);
            Graphics g = Graphics.FromImage(m_obPic);
            g.Clear(Color.White);
            if (target != null)
            {
                target.Width = width;
                target.Height = height;
                target.Image = m_obPic;
            }
            //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡα�������
            for (int i = 0; i < 25; i++)
            {
                int x1 = m_obRandom.Next(m_obPic.Width);
                int x2 = m_obRandom.Next(m_obPic.Width);
                int y1 = m_obRandom.Next(m_obPic.Height);
                int y2 = m_obRandom.Next(m_obPic.Height);
                g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
            }
            //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ��ַ�����
            Font font = new Font("Arial", 12, (FontStyle.Bold | FontStyle.Italic));

            string code = getVerifyCode(5);
            LinearGradientBrush brush
                = new LinearGradientBrush(new Rectangle(0, 0, m_obPic.Width, m_obPic.Height), Color.Blue, Color.DarkRed, 1.2f, true);
            g.DrawString(code, font, brush, 2, 0);
            //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ�ǰ������
            for (int i = 0; i < 100; i++)
            {
                int x = m_obRandom.Next(m_obPic.Width);
                int y = m_obRandom.Next(m_obPic.Height);
                m_obPic.SetPixel(x, y, Color.FromArgb(m_obRandom.Next()));
            }
        }
开发者ID:r1ng0to3tour,项目名称:swsplayer,代码行数:36,代码来源:VerifyPictureMaker.cs

示例7: RadarHandler

 public RadarHandler(PictureBox _radarPictureBox)
 {
     radarPictureBox = _radarPictureBox;
     radar = new Radar(radarPictureBox.Width);
     StaticRadarItems = new SquareRadarItem[3];
     for (int i = 0; i < 3; i++)
     {
         StaticRadarItems[i] = new SquareRadarItem(i, 8, 0, 0);
     }
     StaticRadarItems[2].Azimuth = 45;
     StaticRadarItems[0].Azimuth = 315;
     DynamicRadarItems = new CircleRadarItem[9];
     for (int i = 0; i < 9; i++)
     {
         DynamicRadarItems[i] = new CircleRadarItem(i + 5, 8, 0, 0);
     }
     DynamicRadarItems[0].Azimuth = 360 - 90;
     DynamicRadarItems[1].Azimuth = 360 - 67;
     DynamicRadarItems[2].Azimuth = 360 - 45;
     DynamicRadarItems[3].Azimuth = 360 - 22;
     DynamicRadarItems[4].Azimuth = 0;
     DynamicRadarItems[5].Azimuth = 22;
     DynamicRadarItems[6].Azimuth = 45;
     DynamicRadarItems[7].Azimuth = 67;
     DynamicRadarItems[8].Azimuth = 90;
     RearRadarItem = new TriangleRadarItem(4, 8, 180, 0);
     radar.ImageUpdate += new ImageUpdateHandler(_radar_ImageUpdate);
     radar.DrawScanInterval = 60;
     radar.DrawScanLine = true;
 }
开发者ID:krisztianmukli,项目名称:RobotControlPanel,代码行数:30,代码来源:RadarHandler.cs

示例8: DisplayPicture

 public void DisplayPicture(Bitmap img, PictureBox picBox)
 {
     picBox.Invoke(new EventHandler(delegate
     {
         picBox.Image = img;
     }));
 }
开发者ID:ThuTrangK57,项目名称:sigateWsan,代码行数:7,代码来源:ShowData.cs

示例9: InitializeView

        /// <summary>
        /// Initializes the view.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        public void InitializeView(int width, int height)
        {
            draggedPictureBox = new PictureBox();
            draggedPictureBox.Size = new System.Drawing.Size(PICTURE_BOX_SIZE, PICTURE_BOX_SIZE);
            draggedPictureBox.BackColor = Color.Transparent;
            draggedPictureBox.Visible = false;
            pnlDraw.Controls.Add(draggedPictureBox);
            pictureBoxes = new PictureBox[height][];
            for (int y = 0; y < height; y++)
            {
                pictureBoxes[y] = new PictureBox[width];
                for (int x = 0; x < width; x++)
                {
                    pictureBoxes[y][x] = new PictureBox();
                    pictureBoxes[y][x].SetBounds(x * PICTURE_BOX_SIZE, y * PICTURE_BOX_SIZE, PICTURE_BOX_SIZE, PICTURE_BOX_SIZE);
                    pictureBoxes[y][x].BackgroundImageLayout = ImageLayout.Center;
                    pictureBoxes[y][x].SizeMode = PictureBoxSizeMode.CenterImage;

                    PictureBox objectBox = new PictureBox();
                    objectBox.Parent = pictureBoxes[y][x];
                    objectBox.BackColor = Color.Transparent;
                    objectBox.Size = new System.Drawing.Size(32, 32);
                    objectBox.SizeMode = PictureBoxSizeMode.CenterImage;
                    objectBox.Location = new System.Drawing.Point((pictureBoxes[y][x].Size.Width - objectBox.Size.Width) / 2, (pictureBoxes[y][x].Size.Height - objectBox.Size.Height) / 2);
                    pictureBoxes[y][x].Controls.Add(objectBox);

                    pnlDraw.Controls.Add(pictureBoxes[y][x]);
                }
            }
            pnlDraw.AutoScroll = true;
        }
开发者ID:SamuelDaigle,项目名称:MapEditor,代码行数:36,代码来源:View.cs

示例10: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
         System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Splash));
         this.pictureBox1 = new System.Windows.Forms.PictureBox();
         this.timer1 = new System.Windows.Forms.Timer(this.components);
         this.SuspendLayout();
         //
         // pictureBox1
         //
         this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
         this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
         this.pictureBox1.Name = "pictureBox1";
         this.pictureBox1.Size = new System.Drawing.Size(632, 416);
         this.pictureBox1.TabIndex = 0;
         this.pictureBox1.TabStop = false;
         //
         // Splash
         //
         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(632, 416);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                       this.pictureBox1});
         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
         this.Name = "Splash";
         this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
         this.Text = "Splash";
         this.ResumeLayout(false);
 }
开发者ID:mymindleaks,项目名称:dX---discover-and-eXplore,代码行数:33,代码来源:Splash.cs

示例11: client_DownloadDataCompleted

        void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            if (e.Cancelled || e.Error != null)
            {
                return;
            }

            int width = 200;
            int height = 200;

            if (e.UserState != null)
            {
                FlickrNet.Photo photo = (FlickrNet.Photo)e.UserState;

                width = photo.SmallWidth.HasValue ? photo.SmallWidth.Value : width;
                height = photo.SmallHeight.HasValue ? photo.SmallHeight.Value : height;
            }

            byte[] imageData = e.Result;
            PictureBox pictureBox = new PictureBox();
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox.Size = new Size(width, height);

            using (MemoryStream stream = new MemoryStream(imageData))
            {
                pictureBox.Image = Image.FromStream(stream);
            }

            progressBar1.PerformStep();

            flowLayoutPanel1.Controls.Add(pictureBox);
        }
开发者ID:usmanghani,项目名称:Quantae,代码行数:32,代码来源:Form1.cs

示例12: Set

 public void Set(int index)
 {
     indexx = index;
     pictureBox1.ImageLocation = Data.Entries[index].ImageURL;
     label1.Text = Data.Entries[index].Name;
     pictureBox1.Load();
     int tmp = Data.Entries[index].Difficulty;
     while (tmp != 0)
     {
         PictureBox p = new PictureBox();
         p.ImageLocation = "http://i.imgur.com/0hzGJrP.png";
         p.SizeMode = PictureBoxSizeMode.CenterImage;
         p.Anchor = AnchorStyles.None;
         Size size = new Size();
         size.Height = 10;
         size.Width = 8;
         p.Size = size;
         flowLayoutPanel1.Controls.Add(p);
         tmp--;
     }
     if (Data.Entries[index].Enabled)
     {
         panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
     }
     else
     {
         panel1.BackColor = System.Drawing.SystemColors.ControlLightLight;
     }
 }
开发者ID:PixelZerg,项目名称:DungeonNotif,代码行数:29,代码来源:UserControl1.cs

示例13: ShowImage

 public static void ShowImage(Bitmap bitmap)
 {
     var form = new Form { ClientSize = bitmap.Size };
      var pb = new PictureBox { Image = bitmap, SizeMode = PictureBoxSizeMode.AutoSize };
      form.Controls.Add(pb);
      form.Show();
 }
开发者ID:ItzWarty,项目名称:the-dargon-project,代码行数:7,代码来源:DebuggingUtilities.cs

示例14: InitPictures

 // создает элементы
 public void InitPictures()
 {
     box = new PictureBox[width, height];
     int bw, bh;
     bw = panel.Width / width;
     bh = panel.Height / height;
     if (bw < bh)
         bh = bw;
     else
         bw = bh;
     box = new PictureBox[width, height];
     panel.Controls.Clear();
     for (int x = 0; x < width; x++)
         for (int y = 0; y < height; y++)
         {
             PictureBox picture = new PictureBox();
             picture.BackColor = System.Drawing.Color.Transparent;
             picture.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
             picture.Location = new System.Drawing.Point(x * (bw - 1), y * (bh - 1));
             picture.Size = new System.Drawing.Size(bw, bh);
             picture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
             picture.MouseClick += new System.Windows.Forms.MouseEventHandler(Picture_MouseClick);
             picture.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(Picture_MouseDorbleClick);
             picture.Tag = new Place(x, y);
             panel.Controls.Add(picture);
             box[x, y] = picture;
         }
 }
开发者ID:hely80,项目名称:Sokoban,代码行数:29,代码来源:Labirint.cs

示例15: Run

 private void Run(WebCameraControl wc, PictureBox pb1, PictureBox pb2)
 {
     while(true)
     {
         myEvent(wc, pb1, pb2);
     }
 }
开发者ID:ziVaza,项目名称:cyber_project,代码行数:7,代码来源:Form1.cs


注:本文中的System.Windows.Forms.PictureBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。