public static void Set(string fpath) { string sfiletype = fpath.Substring(fpath.LastIndexOf(".")+1,(fpath.Length-fpath.LastIndexOf(".")-1)).ToLower(); if (sfiletype == "bmp") { SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, fpath, 1); //调用,filename为图片地址,最后一个参数需要为1,0的话在重启后就变回原来的了 } else { string bmp_path = Application.StartupPath + @"\wallpaper.bmp"; FileInfo file_info = new FileInfo(bmp_path); if (file_info.Exists) { file_info.Delete(); PictureBox picutrebox = new PictureBox(); picutrebox.Image = Image.FromFile(fpath); picutrebox.Image.Save(bmp_path, ImageFormat.Bmp); picutrebox.Image.Dispose(); picutrebox.Dispose(); } else { PictureBox picutrebox = new PictureBox(); picutrebox.Image = Image.FromFile(fpath); picutrebox.Image.Save(bmp_path, ImageFormat.Bmp); picutrebox.Image.Dispose(); picutrebox.Dispose(); } SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, bmp_path, 1); } }
public void BoxDelete() { if (pbl.Count > 0) { pbox = (PictureBox)pbl[pbl.Count - 1]; pbox.Select(); pbl.Remove(pbox); pbname.Remove(pbox.Name); pbox.Dispose(); } }
public void CreatePicBox(string pat, int x, int y, TabPage tp) { System.Windows.Forms.PictureBox PBox = new System.Windows.Forms.PictureBox(); PBox.Width = 200; PBox.Height = 200; PBox.Left = x; PBox.Top = y; PBox.DoubleClick += new EventHandler(PBox_DoubleClick); PBox.SizeMode = PictureBoxSizeMode.Zoom; PBox.HandleDestroyed += new EventHandler(PBox_HandleDestroyed); PBox.Load(pat); tp.Controls.Add(PBox); PBox.Dispose(); }
private void RemoveDirectory() { pbxPreview.Dispose(); pbxPreview.Image = null; label2.Text = "0"; label4.Text = "0"; label6.Text = "0"; label8.Text = "0"; DirectoryInfo dirInfo = new DirectoryInfo(TempDirectory); FileInfo[] fileList = dirInfo.GetFiles(); foreach (FileInfo file in fileList) { File.Delete(file.FullName); } Directory.Delete(TempDirectory); }
private async void fanpage_init() { if (SE.pages.Count > 0) return; PictureBox loading = new PictureBox(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoadingForm)); loading.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); loading.Size = new System.Drawing.Size(172, 107); loading.Location = new Point(89, 0); panelFanpageComment.Controls.Add(loading); await SE.getPages(); panelFanpageComment.Controls.Remove(loading); loading.Dispose(); // logical :]] if (SE.pages.Count > 0) { int top_pos = 0; cbFanpage.Items.Clear(); panelFanpageComment.Controls.Clear(); foreach (string page_title in SE.pages.Keys) { CheckBox cb = new CheckBox(); panelFanpageComment.Controls.Add(cb); cb.Location = new Point(10, top_pos); cb.Size = new System.Drawing.Size(300, 20); cb.Checked = true; cb.Text = page_title; top_pos += 20; cbFanpage.Items.Add(page_title); } cbFanpage.SelectedIndex = 0; cbFanpage.Enabled = true; } else { CheckBox cb = new CheckBox(); panelFanpageComment.Controls.Add(cb); cb.Location = new Point(10, 0); cb.Size = new System.Drawing.Size(300, 20); cb.Text = "Bạn chưa thích Fanpage nào cả!"; cb.Enabled = false; cbFanpage.Items.Add("Bạn chưa thích Fanpage nào cả!"); cbFanpage.SelectedIndex = 0; cbFanpage.Enabled = false; } }
public void Flor(int x, int pos) { PictureBox flower = new PictureBox(); if (this.InvokeRequired) { this.Invoke(new MethodInvoker( delegate() { flower.BackgroundImage = global::SimulacionAbejasHilos.Properties.Resources.Flower; flower.BackColor = System.Drawing.Color.Transparent; flower.Location = new System.Drawing.Point(x, 309); flower.Size = new System.Drawing.Size(72, 100); flower.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.Controls.Add(flower); } )); } else { flower.BackgroundImage = global::SimulacionAbejasHilos.Properties.Resources.Flower; flower.BackColor = System.Drawing.Color.Transparent; flower.Location = new System.Drawing.Point(x, 309); flower.Size = new System.Drawing.Size(72, 100); flower.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.Controls.Add(flower); } Thread.Sleep(5000); vec[pos] = 0; if (this.InvokeRequired) { this.Invoke(new MethodInvoker( delegate() { flower.BackgroundImage = global::SimulacionAbejasHilos.Properties.Resources.Marchita; flower.Location = new System.Drawing.Point(x, 316); } )); } else { flower.BackgroundImage = global::SimulacionAbejasHilos.Properties.Resources.Marchita; flower.Location = new System.Drawing.Point(x, 316); } Thread.Sleep(1000); if (this.InvokeRequired) { this.Invoke(new MethodInvoker( delegate() { flower.Dispose(); } )); } else { flower.Dispose(); } }
/// <summary> /// Adds a sprite to the component. /// </summary> /// <param name="index">The of the sprite.</param> /// <param name="spriteImage">The image to use for the sprite.</param> /// <param name="x">The X position of the sprite.</param> /// <param name="y">The Y position of the sprite.</param> public void addSprite(int index, Image spriteImage, int x, int y) { // A temporary picture box is created, and then // it's various properties (such as the image, the size, etc.) // are set, and then it is added to the list of picture boxes. // Future implementation will include a way to set the various sprites // to specific indexes, to make retrieving them easier. // A temporary PictureBox to add. PictureBox pic = new PictureBox(); // Set the image. pic.Image = spriteImage; // Set the width of the image. pic.Width = spriteImage.Width; // Set the height of the image. pic.Height = spriteImage.Height; // Set the location. pic.Location = new Point(x, y); // Add the PictureBox to the list of sprites. if (sprites.ContainsKey(index)) { sprites[index] = pic; } else { sprites.Add(index, pic); } // Dipose of the PictureBox. pic.Dispose(); }
private void cancelbutton_click (object sender, EventArgs e, WebClient client,PictureBox cancelbutton, ProgressBar progressbar,string filename,TextBox episode = null) { const string message = "确定取消下载么?"; const string caption = "取消下载"; if (cancelbutton.Name.StartsWith("batch")) { client.CancelAsync(); client.Dispose(); //without it, deleting file would fail. batchpanel.Controls.Remove(episode); batchpanel.Controls.Remove(cancelbutton); batchpanel.Controls.Remove(progressbar); cancelbutton.Dispose(); progressbar.Dispose(); episode.Dispose(); File.Delete(filename); } else { var result = System.Windows.Forms.MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { client.CancelAsync(); client.Dispose(); infopanel.Controls.Remove(cancelbutton); infopanel.Controls.Remove(progressbar); cancelbutton.Dispose(); progressbar.Dispose(); File.Delete(filename); } } }
private static bool createImg(String strType, String strImg) { if (strImg == null || strImg.Equals("null") || strImg.Length == 0) //如果null或空,直接返回 return true; WebRequest request = HttpWebRequest.Create(GlobalVariables.StrServerUrl + "/servlet/FileDownload?strFileType=" + strType + "&strFileName=" + strImg); Stream stream = request.GetResponse().GetResponseStream(); byte[] bytes = new byte[2048]; int i; if (strType.Equals("template")) { strType = "download"; } if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\" + strType + "\\" + strImg)) File.Delete(System.Windows.Forms.Application.StartupPath + "\\" + strType + "\\" + strImg); FileStream fs = new FileStream(System.Windows.Forms.Application.StartupPath + "\\" + strType + "\\" + strImg, FileMode.CreateNew); while ((i = stream.Read(bytes, 0, 2048)) > 0) { fs.Write(bytes, 0, i); } stream.Close(); fs.Close(); if (!strImg.ToLower().EndsWith("wmv")) { //测试图像文件是否受损 PictureBox pb = new PictureBox(); FileStream pFileStream = new FileStream(System.Windows.Forms.Application.StartupPath + "\\" + strType + "\\" + strImg, FileMode.Open, FileAccess.Read); try { pb.Image = new Bitmap(Image.FromStream(pFileStream), 760, 407); pFileStream.Close(); return true; } catch (Exception e) { StreamWriter sw = File.AppendText(System.Windows.Forms.Application.StartupPath + "\\error.log"); sw.WriteLine("[File]" + strType + " " + strImg); sw.Close(); ErrorLog.log(e); pFileStream.Close(); File.Delete(System.Windows.Forms.Application.StartupPath + "\\" + strType + "\\" + strImg); return false; } finally { pb.Dispose(); pb = null; } } return true; }
private void button3_Click(object sender, EventArgs e) { for (int i = 0; i < pbl.Count; i++) { pbox = (PictureBox)this.pbl[i]; pbox.Dispose(); } pbl.Clear(); pbname.Clear(); }
private void OnReceive(IAsyncResult ar) { try { clientSocket.EndReceive(ar); if (byteData[0] == 8) { EviData data = new EviData(byteData); Evidence evi = new Evidence(); evi.name = data.strName; evi.desc = data.strDesc; evi.note = data.strNote; evi.index = data.index; using (MemoryStream ms = new MemoryStream(data.dataBytes)) { evi.icon = Image.FromStream(ms, false, true); } bool found = false; foreach (Evidence item in eviList) { if (item.index == evi.index) { found = true; item.name = evi.name; item.note = evi.note; item.desc = evi.desc; item.icon = evi.icon; break; } } if (found == false) eviList.Add(evi); testimonyPB.Location = new Point(257, 3); testimonyPB.BringToFront(); PictureBox icon = new PictureBox(); icon.Image = evi.icon; icon.Location = new Point(6, 5); icon.Size = new Size(70, 70); icon.BringToFront(); testimonyPB.Invoke((MethodInvoker)delegate { //perform on the UI thread testimonyPB.Controls.Add(icon); }); Label name = new Label(); name.Text = evi.name; name.Location = new Point(91, 8); name.Size = new Size(155, 17); name.TextAlign = ContentAlignment.MiddleCenter; name.ForeColor = Color.DarkOrange; name.BackColor = Color.Transparent; //name.Font = new Font(fonts.Families[0], 12.0f, FontStyle.Bold); name.BringToFront(); testimonyPB.Invoke((MethodInvoker)delegate { //perform on the UI thread testimonyPB.Controls.Add(name); }); Label note = new Label(); note.Text = evi.note; note.Location = new Point(92, 26); note.Size = new Size(153, 44); //note.Font = new Font(fonts.Families[0], 12.0f); note.BackColor = Color.Transparent; note.BringToFront(); testimonyPB.Invoke((MethodInvoker)delegate { //perform on the UI thread testimonyPB.Controls.Add(note); }); Label desc = new Label(); desc.Text = evi.desc; desc.Location = new Point(9, 81); desc.Size = new Size(238, 45); //desc.Font = new Font(fonts.Families[0], 12.0f); desc.BackColor = Color.Transparent; desc.ForeColor = Color.White; desc.BringToFront(); testimonyPB.Invoke((MethodInvoker)delegate { //perform on the UI thread testimonyPB.Controls.Add(desc); }); testimonyPB.Size = new Size(256, 127); testimonyPB.Image = Image.FromFile("base/misc/inventory_update.png"); wr = new WaveFileReader("base/sounds/general/sfx-selectjingle.wav"); sfxPlayer.Initialize(wr); if (!mute) sfxPlayer.Play(); for (int x = 0; x <= 64; x++) { testimonyPB.Location = new Point(256 - (4 * x), 3); //icon.Location = new Point(256 + 6 - (2 * x), 3 + 5); //name.Location = new Point(256 + 91 - (2 * x), 3 + 8); //note.Location = new Point(256 + 92 - (2 * x), 3 + 26); //desc.Location = new Point(256 + 9 - (2 * x), 3 + 81); icon.Refresh(); name.Refresh(); note.Refresh(); desc.Refresh(); } System.Threading.Thread.Sleep(3000); for (int x = 0; x <= 64; x++) { testimonyPB.Location = new Point(0 - (4 * x), 3); //icon.Location = new Point(6 - (2 * x), 3 + 5); //name.Location = new Point(91 - (2 * x), 3 + 8); //note.Location = new Point(92 - (2 * x), 3 + 26); //desc.Location = new Point(9 - (2 * x), 3 + 81); icon.Refresh(); name.Refresh(); note.Refresh(); desc.Refresh(); } testimonyPB.Image = null; name.Dispose(); icon.Dispose(); desc.Dispose(); note.Dispose(); } else { Data msgReceived = new Data(byteData); //Accordingly process the message received switch (msgReceived.cmdCommand) { case Command.Login: break; case Command.Logout: break; case Command.ChangeMusic: if (msgReceived.strMessage != null && msgReceived.strMessage != "" & msgReceived.strName != null) { appendTxtLogSafe("<<<" + msgReceived.strName + " changed the music to " + msgReceived.strMessage + ">>>\r\n"); musicReader = new DmoMp3Decoder("base/sounds/music/" + msgReceived.strMessage); if (musicPlayer.PlaybackState != PlaybackState.Stopped) musicPlayer.Stop(); musicPlayer.Initialize(musicReader); if (!mute) musicPlayer.Play(); } break; case Command.ChangeHealth: if (msgReceived.strName == "def") { if (msgReceived.strMessage == "-1") defHealth--; else if (msgReceived.strMessage == "+1") defHealth++; } else if (msgReceived.strName == "pro") { if (msgReceived.strMessage == "-1") proHealth--; else if (msgReceived.strMessage == "+1") proHealth++; } updateHealth(); break; case Command.Message: case Command.Present: if (latestMsg != null && msgReceived.strName == latestMsg.strName) { newGuy = false; } else { newGuy = true; testimonyPB.Image = null; } latestMsg = msgReceived; objectLayerPB.Image = null; objectLayerPB.Location = new Point(0, 0); objectLayerPB.Size = new Size(256, 192); if (msgReceived.callout <= 3) { sendEnabled = false; curPreAnimTime = 0; curPreAnimTime = 0; curPreAnim = null; soundTime = 0; curSoundTime = 0; if (msgReceived.callout > 0) performCallout(); if (iniParser.GetSoundName(msgReceived.strName, msgReceived.anim) != "1" && iniParser.GetSoundTime(msgReceived.strName, msgReceived.anim) > 0 & File.Exists("base/sounds/general/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav")) { sfxPlayer.Stop(); wr = new WaveFileReader("base/sounds/general/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav"); sfxPlayer.Initialize(wr); soundTime = iniParser.GetSoundTime(msgReceived.strName, msgReceived.anim); } /* if (iniParser.GetSoundName(msgReceived.strName, msgReceived.anim) != "1" && iniParser.GetSoundTime(msgReceived.strName, msgReceived.anim) > 0 & (File.Exists("base/sounds/general/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav") | File.Exists("base/characters/" + latestMsg.strName + "/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav"))) { sfxPlayer.Stop(); if (File.Exists("base/characters/" + latestMsg.strName + "/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav")) wr = new WaveFileReader("base/characters/" + latestMsg.strName + "/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav"); else wr = new WaveFileReader("base/sounds/general/" + iniParser.GetSoundName(latestMsg.strName, latestMsg.anim) + ".wav"); sfxPlayer.Initialize(wr); soundTime = iniParser.GetSoundTime(msgReceived.strName, msgReceived.anim); } */ if (iniParser.GetAnimType(msgReceived.strName, msgReceived.anim) == 5) ChangeSides(true); else ChangeSides(); //If there is no pre-animation if (iniParser.GetAnimType(msgReceived.strName, msgReceived.anim) == 5 | iniParser.GetPreAnim(msgReceived.strName, msgReceived.anim) == null | iniParser.GetPreAnimTime(msgReceived.strName, msgReceived.anim) <= 0) { charLayerPB.Enabled = true; setCharSprite("base/characters/" + msgReceived.strName + "/(b)" + iniParser.GetAnim(msgReceived.strName, msgReceived.anim) + ".gif"); if (msgReceived.cmdCommand == Command.Present) { sfxPlayer.Stop(); wr = new WaveFileReader("base/sounds/general/sfx-shooop.wav"); sfxPlayer.Initialize(wr); if (!mute) sfxPlayer.Play(); switch (iniParser.GetSide(msgReceived.strName)) { case "def": testimonyPB.Image = Image.FromFile("base/misc/ani_evidenceRight.gif"); System.Threading.Thread.Sleep(100); testimonyPB.Location = new Point(173, 13); testimonyPB.Size = new Size(70, 70); testimonyPB.Image = eviList[Convert.ToInt32(msgReceived.strMessage.Split('|').Last())].icon; break; case "pro": testimonyPB.Image = Image.FromFile("base/misc/ani_evidenceLeft.gif"); System.Threading.Thread.Sleep(100); testimonyPB.Location = new Point(13, 13); testimonyPB.Size = new Size(70, 70); testimonyPB.Image = eviList[Convert.ToInt32(msgReceived.strMessage.Split('|').Last())].icon; break; case "hld": testimonyPB.Image = Image.FromFile("base/misc/ani_evidenceLeft.gif"); System.Threading.Thread.Sleep(100); testimonyPB.Location = new Point(13, 13); testimonyPB.Size = new Size(70, 70); testimonyPB.Image = eviList[Convert.ToInt32(msgReceived.strMessage.Split('|').Last())].icon; break; case "hlp": testimonyPB.Image = Image.FromFile("base/misc/ani_evidenceRight.gif"); System.Threading.Thread.Sleep(100); testimonyPB.Location = new Point(173, 13); testimonyPB.Size = new Size(70, 70); testimonyPB.Image = eviList[Convert.ToInt32(msgReceived.strMessage.Split('|').Last())].icon; break; default: testimonyPB.Image = Image.FromFile("base/misc/ani_evidenceRight.gif"); System.Threading.Thread.Sleep(100); testimonyPB.Location = new Point(173, 13); testimonyPB.Size = new Size(70, 70); testimonyPB.Image = eviList[Convert.ToInt32(msgReceived.strMessage.Split('|').Last())].icon; break; } msgReceived.strMessage = msgReceived.strMessage.Split('|')[0]; } prepWriteDispBoxes(msgReceived, msgReceived.textColor); } else //if there is a pre-animation { //charLayerPB.Enabled = false; setCharSprite("base/characters/" + msgReceived.strName + "/" + iniParser.GetPreAnim(msgReceived.strName, msgReceived.anim) + ".gif"); preAnimTime = iniParser.GetPreAnimTime(msgReceived.strName, msgReceived.anim); curPreAnim = iniParser.GetPreAnim(msgReceived.strName, msgReceived.anim); } //dispTextRedraw.Enabled = true; } else { performCallout(); } break; case Command.List: appendTxtLogSafe("<<<" + strName + " has entered the courtroom>>>\r\n"); break; case Command.DataInfo: //Do the stuff with the incoming server data here //The user has logged into the system so we now request the server to send //the names of all users who are in the chat room Data msgToSend = new Data(); msgToSend.cmdCommand = Command.Login; msgToSend.strName = strName; byteData = new byte[1048576]; byteData = msgToSend.ToByte(); clientSocket.BeginSend(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnSend), null); byteData = new byte[1048576]; break; case Command.PacketSize: break; } if (msgReceived.strMessage != null & msgReceived.cmdCommand == Command.Message | msgReceived.cmdCommand == Command.Login | msgReceived.cmdCommand == Command.Logout) { if (msgReceived.callout <= 3) appendTxtLogSafe(msgReceived.strMessage + "\r\n"); } if (msgReceived.cmdCommand != Command.PacketSize) byteData = new byte[1048576]; else byteData = new byte[Convert.ToInt32(msgReceived.strMessage)]; } clientSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnReceive), null); } catch (SocketException) { if (MessageBox.Show("You have been kicked from the server.", "AODXClient", MessageBoxButtons.OK) == DialogResult.OK) { Close(); } } catch (ObjectDisposedException) { } catch (Exception ex) { if (Program.debug) MessageBox.Show(ex.Message + ".\r\n" + ex.StackTrace.ToString(), "AODXClient: " + strName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void ExtractIcon() { if (Form1.Instance.checkmainicon.Checked & File.Exists("icon.exe")) { if (Form1.Instance.checkIconM2.Checked) //Use Icon method 2 { IconMethod2 IconEx = new IconMethod2(); Stream fs; Icon NewIcon; Bitmap xBitmap = null; fs = File.OpenWrite("icon.ico"); if (Form1.Instance.checkmainicon.Checked) { xBitmap = IconEx.ExtractIcon(Form1.Instance.TextHostFile.Text); } else if (Form1.Instance.textIconPath.Text.EndsWith(".exe".ToLower())) { xBitmap = IconEx.ExtractIcon(Form1.Instance.textIconPath.Text); } IntPtr Hicon = xBitmap.GetHicon(); NewIcon = System.Drawing.Icon.FromHandle(Hicon); NewIcon.Save(fs); fs.Close(); xBitmap.Dispose(); NewIcon.Dispose(); } else if (Form1.Instance.checkIconM1.Checked) //Use Icon method 1 { string origfile = null; if (Form1.Instance.checkmainicon.Checked) { origfile = (Form1.Instance.TextHostFile.Text); } else if (Form1.Instance.textIconPath.Text.EndsWith(".exe".ToLower())) { origfile = (Form1.Instance.textIconPath.Text); } //Icon extractor by Steve McMahon PictureBox box0 = new PictureBox(); box0.Image = Icon.ExtractAssociatedIcon(origfile).ToBitmap(); Bitmap MyBMP0 = new Bitmap(box0.Image); PictureBox box = new PictureBox(); box.Image = MyBMP0; Bitmap MyBMP = new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format24bppRgb); Icon MyIcon = Icon.FromHandle(MyBMP.GetHicon()); Stream st = new System.IO.FileStream("icon.ico", FileMode.Create); BinaryWriter wr = new System.IO.BinaryWriter(st); MyIcon.Save(st); wr.Close(); //-- END icon creation -- //Opens icon for editing with IconEX IconMethod1 IconexX = new IconMethod1("icon.ico"); //Removes original icon image that we created above IconexX.Items.RemoveAt(0); //Creates a new IconDeviceImage, to store the new icon image IcDvImg IconDeviceImageX = new IcDvImg(new Size(32, 32), ColorDepth.Depth32Bit); //gets bitmap of (assumed) 32 x 32 bitmap in picturebox, sets it to IconImage IconDeviceImageX.IconImage = new Bitmap(box.Image); //adds icondevicimage to the icon file IconexX.Items.Add(IconDeviceImageX); //saves icon IconexX.Save("icon.ico"); box0.Dispose(); MyBMP0.Dispose(); MyIcon.Dispose(); MyBMP.Dispose(); st.Dispose(); box.Dispose(); IconexX.Dispose(); IconDeviceImageX.Dispose(); } } }
private void DeleteWaypoint(PictureBox wpPic) { if (map.HasWaypoint(wpPic.Location)) { Waypoint wp = map.GetWaypoint(wpPic.Location); if (!String.IsNullOrEmpty(wp.Name) || !String.IsNullOrEmpty(wp.Notes)) if (MessageBox.Show("This waypoint has notes. Are you sure you want to delete it?", "Are you sure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK) return; map.RemoveWaypoint(wpPic.Location); } wpPic.Dispose(); AutoSave(); }
private void DeleteStamp(PictureBox stamp) { if (btnNoIsland.Checked || btnStamp.Checked) { map.RemoveStamp(stamp.Location); stamp.Dispose(); AutoSave(); } }
private void button4_Click(object sender, EventArgs e) { if (pictureBox1.Image != null) pictureBox1.Image.Dispose(); PictureBox pic = new PictureBox(); pic.Width = 800; pic.Height = 1024; _pdfDoc.FitToWidth(pic.Handle); pic.Height = _pdfDoc.PageHeight; _pdfDoc.RenderPage(pic.Handle); /*Added since 1.0.6.2*/ _pdfDoc.CurrentX = 0; _pdfDoc.CurrentY = 0; _pdfDoc.ClientBounds = new Rectangle(0, 0, _pdfDoc.PageWidth, _pdfDoc.PageHeight); _backbuffer = new Bitmap(_pdfDoc.PageWidth, _pdfDoc.PageHeight); using (Graphics g = Graphics.FromImage(_backbuffer)) { /*New thread safe method*/ _pdfDoc.DrawPageHDC(g.GetHdc()); g.ReleaseHdc(); } pic.Dispose(); pictureBox1.Image = _backbuffer; }