第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

pictureBox如何改變控件位置

pictureBox如何改變控件位置

幕布斯7119047 2018-12-06 19:08:10
界面:button,timer,picturebox 代碼: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Drawing.Drawing2D;namespace PictureSport; { public partial class Test_Picture_Yuan : Form { public Test_Picture_Yuan() { InitializeComponent(); } private Graphics g; private Bitmap bmp; private Pen pen; private Point start; private Point stop; Bitmap image1; public Point P_lo; private void Test_Picture_Yuan_Load(object sender, EventArgs e) { timer1.Enabled = false; bmp = new Bitmap(this.Width, this.Height); g = Graphics.FromImage(bmp); //g = this.CreateGraphics(); pen = new Pen(Color.Red); } int i = 1; private void Test_Picture_Yuan_MouseClick(object sender, MouseEventArgs e) { if (i == 1) { start = e.Location; i++; } else { if (i == 2) { stop = e.Location; g.DrawLine(pen, start, stop); i++; this.BackgroundImage = bmp; } } } private void button1_Click(object sender, EventArgs e) { // g.DrawLine(pen, start, stop); //直線的坐標(biāo) 橫軸坐標(biāo)不變, 縱軸坐標(biāo)+ - 50 //(pen,start,stop) (pen,new Point (start.X,start.Y-50),new Point (stop.X,stop.Y-50)) (pen, new Point(start.X, start.Y +50), new Point(stop.X, stop.Y +50)) //圓的坐標(biāo) 橫軸坐標(biāo)不變, 縱軸坐標(biāo)+ - 50 //(pen,start.X-15,start.Y-15,30,30); (pen, start.X - 15, start.Y - 65, 30, 30); (pen, start.X - 15, start.Y + 35, 30, 30); g.DrawLine(pen,new Point (start.X,start.Y-50),new Point (stop.X,stop.Y-50)); g.DrawLine(pen, new Point(start.X, start.Y +50), new Point(stop.X, stop.Y +50)); timer1.Enabled = true; try { // Retrieve the image. image1 = new Bitmap(Application.StartupPath + @"/images/black.png", true); int x, y; // Loop through the images pixels to reset color. for (x = 0; x < image1.Width; x++) { for (y = 0; y < image1.Height; y++) { Color pixelColor = image1.GetPixel(x, y); Color newColor = Color.FromArgb(pixelColor.B, 0, 0); image1.SetPixel(x, y, newColor); } } // Set the PictureBox to display the image. pictureBox1.Image = image1; } catch (ArgumentException) { MessageBox.Show("There was an error." + "Check the path to the image file."); } this.BackgroundImage = null; this.BackgroundImage = bmp; } private void timer1_Tick(object sender, EventArgs e) { P_lo = pictureBox1.Location; P_lo = new Point(start.X, start.Y); P_lo.X ++; P_lo.Y ++; pictureBox1.Location = P_lo; } }}
查看完整描述

1 回答

?
森林海

TA貢獻(xiàn)2011條經(jīng)驗(yàn) 獲得超2個(gè)贊

pictureBox1.Location =?new Point(pictureBox1.Location.X + 1, pictureBox1.Location.Y + 1)
查看完整回答
反對(duì) 回復(fù) 2018-12-09
  • 1 回答
  • 0 關(guān)注
  • 542 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)