protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DirectoryInfo imagename = new DirectoryInfo(Server.MapPath("~/pictures/")); Picture1.DataSource = imagename.GetFiles("*.*"); Picture1.DataBind(); } }
//public string TvType //{ // get { return comboBox1.Text; } // // set { tvType = value; } //} private void dgv1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { for (int i = 0; i < dgv1.RowCount; i++) { if (e.RowIndex == i) { this.Picture1.Paint += Picture1_Paint; Picture1.Invalidate(); } } }
public void Picture1_Click(System.Object eventSender, System.EventArgs eventArgs) { short Index = Picture1.GetIndex(eventSender); if (System.Drawing.ColorTranslator.ToOle(Picture1[Index].BackColor) == Information.RGB(0, 255, 0)) { SET_BUFF(0x11, 0, (byte) Index); } else if (System.Drawing.ColorTranslator.ToOle(Picture1[Index].BackColor) == Information.RGB(255, 0, 0)) { SET_BUFF(0x12, 0, (byte) Index); } }
//save picture and upload public void OnClick4() { byte[] bytes = texture.EncodeToPNG(); //save to local directory //File.WriteAllBytes(Application.dataPath + "/../SavedScreen.png", bytes); string shopID = "02"; string shopName = "麥當勞"; string shopAddress = "公園北路3號"; string telephone = "091234"; Gps gps = new Gps("12.3", "2.4"); List <TimePeriod> timePeriod = new List <TimePeriod>(); timePeriod.Add(new TimePeriod("10", "30", "15", "00")); List <Item> item = new List <Item>(); item.Add(new Item(true, timePeriod)); OpenTime openTime = new OpenTime(item); List <Item2> item2 = new List <Item2>(); item2.Add(new Item2("哈哈", "笑你")); InfoList infoList = new InfoList(item2); List <Item4> item4 = new List <Item4>(); item4.Add(new Item4(bytes, "png")); Picture1 picture = new Picture1(item4); WWWForm formData = new WWWForm(); formData.AddField("shopID", shopID); formData.AddField("shopName", shopName); formData.AddField("shopAddress", shopAddress); formData.AddField("telephone", telephone); formData.AddField("gps", JsonUtility.ToJson(gps)); formData.AddField("openTime", JsonUtility.ToJson(openTime)); formData.AddField("infoList", JsonUtility.ToJson(infoList)); formData.AddField("picture", JsonUtility.ToJson(picture)); StartCoroutine(Upload(formData)); }
private void Text1_TextChanged(object sender, EventArgs e) { //this.Picture1.Paint += Picture1_Paint; Picture1.Refresh(); //Picture1.Invalidate(); }
public void ShowRegion() { if (SourcePic == null) { return; } //TODO finish this line //StretchBlt Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, SourcePic.hDC, CenterX - GridHalfSide, CenterY - GridHalfSide, GridSide, GridSide, SRCCOPY; //Print image into picturebox with Stretch style //update pixel value labels long X = 0; long Y = 0; long i = 0; long h = 0; long j = 0; long color = 0; bool UseHistory = false; if (StatsEnabled & HistCount < m_HistoryLength) { HistCount = HistCount + 1; labelHistCount.ForeColor = Color.Red; } else { labelHistCount.ForeColor = Color.Black; } labelHistCount.Text = HistCount.ToString(); LastI = (LastI + 1) % m_HistoryLength; for (Y = -GridHalfSide; Y <= GridHalfSide; Y++) { for (X = -GridHalfSide; X <= GridHalfSide; X++) { // TODO replace the following Line //PixHistory(X, Y, LastI) = GetPixel(SourcePic.hDC, CenterX + X, CenterY + Y) & 0XFF; if (LabelsEnabled | lblPixVal(i).ForeColor == vbGreen) { if (StatsEnabled) { lblPixVal(i) = System.Convert.ToInt32(PixelAverage(X, Y)); } else { lblPixVal(i) = PixHistory(X, Y, LastI); } lblPixVal(i).Visible = true; } else { lblPixVal(i).Visible = false; } i = i + 1; } } lblStats.Visible = StatsEnabled; if (StatsEnabled) { //compute stats for (Y = -2; Y <= 2; Y++) { for (X = -2; X <= 2; X++) { PixAverageHistory(X, Y, LastI) = PixelAverage(X, Y); } } //lblStats = "Center Avg " & F(PixAverageHistory(0, 0, LastI), 1) & _ lblStats = "Avg all " + f(PixelAverageAll, 2) + ", STD " + f(PixelSTD(0, 0), 2) + ", STD(avg) " + f(STDofAverage(0, 0), 2); if (GridHalfSide >= 2) //find the average stats of a 5x5 grid at the center { Avg5x5 = 0; STD5x5 = 0; STDofAvg5x5 = 0; for (Y = -2; Y <= 2; Y++) { for (X = -2; X <= 2; X++) { Avg5x5 = Avg5x5 + PixAverageHistory(X, Y, LastI) / 25; //average of pixel, including this one STD5x5 = STD5x5 + PixelSTD(X, Y) / 25; STDofAvg5x5 = STDofAvg5x5 + STDofAverage(X, Y) / 25; } } lblStats = lblStats + System.Environment.NewLine + "5x5 Avg " + f(Avg5x5, 1) + ", STD " + f(STD5x5, 2) + ", STD(avg) " + f(f(STDofAvg5x5, 2), 2); } } Picture1.Refresh(); lblXY = "X: " + CenterX + " Y:" + CenterY; if (XPEnabled) { double[] Pos = new double[2]; double[] TCPos = new double[2]; double[] UnitV = null; int[] Val = new int[3]; long XPI = 0; object SideI = null; if (SourcePic == fMain.PictureB(0)) { SideI = 0; } else { SideI = 1; } XPI = NearbyXpointI(fMain.CurrCamera, SideI, CenterX / fMain.DisplayScale, CenterY / fMain.DisplayScale, 5); if (XPI >= 0) { if (GetXpoint(fMain.CurrCamera, SideI, XPI, Pos[0], Pos[1], TCPos[0], TCPos[1], UnitV, Val[0], Val[1], Val[2])) { //draw the lines double[] PC = new double[2]; double LineLen = 0; PC[0] = 0.5 * Picture1.ScaleWidth + (Pos[0] * fMain.DisplayScale - CenterX) * Picture1.ScaleWidth / (2 * GridHalfSide + 1); PC[1] = 0.5 * Picture1.ScaleHeight + (Pos[1] * fMain.DisplayScale - CenterY) * Picture1.ScaleHeight / (2 * GridHalfSide + 1); LineLen = Min(Picture1.Width, Picture1.Height); DrawLine PC[0] - LineLen * UnitV[0, 0], PC[1] - LineLen * UnitV[1, 0], PC[0] + LineLen * UnitV[0, 0], PC[1] + LineLen * UnitV[1, 0], vbBlue;