PNG









How do I use P N G
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: FormSinhVien.cs Copy
27         private void dgvSinhVien_RowEnter(object sender, DataGridViewCellEventArgs e)
28         {
29             dong = e.RowIndex;
30             txtMaSV.Text = dgvSinhVien.Rows[dong].Cells[0].Value.ToString();
31             txtTenSV.Text = dgvSinhVien.Rows[dong].Cells[1].Value.ToString();
32             dtpNgaySinh.Text = dgvSinhVien.Rows[dong].Cells[2].Value.ToString();
33             txtDiaChi.Text = dgvSinhVien.Rows[dong].Cells[3].Value.ToString();
34             cmbMaLop.SelectedValue = dgvSinhVien.Rows[dong].Cells[4].Value.ToString();
35         }
File name: FormSinhVien.cs Copy
37         private void btnThem_Click(object sender, EventArgs e)
38         {
39             if (txtMaSV.Text!="")
40             {
41                 if(business.Proc_Insert("Insert_SinhVien",txtMaSV.Text))
42                 {
43                     string sql = "'"+txtMaSV.Text+"','"+txtTenSV.Text+"','"+dtpNgaySinh.Text+"','"+txtDiaChi.Text+"','"+cmbMaLop.SelectedValue.ToString()+"'";
44                     business.Insert("SinhVien",sql);
45                     FormSinhVien_Load(sender,e);
46                 }
47                 else
48              {
49                     MessageBox.Show("Mã SV đã tồn tại");
50              }
51             }
52         }
File name: FormSinhVien.cs Copy
66         private void btnSua_Click(object sender, EventArgs e)
67         {
68             string sql = "TenSV='" + txtTenSV.Text + "',NgaySinh='" + dtpNgaySinh.Text + "',DiaChi='" + txtDiaChi.Text + "',MaLop='" + cmbMaLop.SelectedValue.ToString() +"' where MaSV='" + txtMaSV.Text + "'";
69             business.Update("SinhVien", sql);
70             FormSinhVien_Load(sender, e);
71         }
File name: PhotonEditor.cs Copy
215     static PhotonEditor()
216     {
217         EditorApplication.projectWindowChanged += EditorUpdate;
218         EditorApplication.hierarchyWindowChanged += EditorUpdate;
219         EditorApplication.playmodeStateChanged += PlaymodeStateChanged;
220         EditorApplication.update += OnUpdate;
221
222         WizardIcon = AssetDatabase.LoadAssetAtPath("Assets/Photon Unity Networking/photoncloud-icon.png", typeof(Texture2D)) as Texture2D;
223
224         // to be used in toolbar, the enum needs conversion to string[] being done here, once.
225         Array enumValues = Enum.GetValues(typeof(CloudRegionCode));
226         CloudServerRegionNames = new string[enumValues.Length];
227         for (int i = 0; i < CloudServerRegionNames.Length; i++)
228         {
229             CloudServerRegionNames[i] = enumValues.GetValue(i).ToString();
230             if (CloudServerRegionNames[i].Equals("none"))
231             {
232                 CloudServerRegionNames[i] = PhotonEditor.CurrentLang.BestRegionLabel;
233             }
234         }
235
236         // detect optional packages
237         PhotonEditor.CheckPunPlus();
238
239     }
File name: PhotonGUI.cs Copy
139     {
140         get
141         {
142             if( m_HelpIcon == null )
143             {
144                 m_HelpIcon = AssetDatabase.LoadAssetAtPath( "Assets/Photon Unity Networking/Editor/PhotonNetwork/help.png", typeof( Texture2D ) ) as Texture2D;
145             }
146
147             return m_HelpIcon;
148         }
149     }
File name: BitmapFont.cs Copy
26     public BitmapFont(string pathPNG, string pathXML, GameObject gameObject)
27     {
28         this.gameObject = gameObject;
29         sprites = new Dictionary();
30         yoffsets_xadvances = new Dictionary();
31         rects = new Dictionary();
32
33         Texture2D texture = Resources.Load(pathPNG);
34         float height = texture.height;
35         TextAsset xml = Resources.Load(pathXML);
36
37         XmlDocument test = new XmlDocument();
38         test.Load(new StringReader(xml.text));
39
40         //test.LoadXml(new StringReader(xml.text).ReadToEnd());
41         //string[] keys = new string[] {"x","y","width","height","yoffset","xadvance","letter"};
42
43         foreach (XmlNode node in test.DocumentElement.ChildNodes)
44         {
45             XmlAttributeCollection collection = node.Attributes;
46             Rect rect = new Rect(float.Parse(collection.Item(0).Value), height - float.Parse(collection.Item(1).Value) - float.Parse(collection.Item(3).Value), float.Parse(collection.Item(2).Value), float.Parse(collection.Item(3).Value));
47             rects.Add(collection.Item(6).Value, rect);
48             sprites.Add(collection.Item(6).Value, Sprite.Create(texture, rect, Vector2.zero));
49             yoffsets_xadvances.Add(collection.Item(6).Value, new Vector2(float.Parse(collection.Item(4).Value), float.Parse(collection.Item(5).Value)));
50         }
51     }
File name: Tiled2UnityMenuItems.cs Copy
17         static void ExportLibrary()
18         {
19             string name = String.Format("Tiled2Unity.{0}.unitypackage", ImportTiled2Unity.ThisVersion);
20             var path = EditorUtility.SaveFilePanel("Save texture as PNG", "", name, "unitypackage");
21             if (path.Length != 0)
22             {
23                 List packageFiles = new List();
24                 packageFiles.AddRange(EnumerateAssetFilesAt("Assets/Tiled2Unity", ".cs", ".shader", ".txt"));
25                 AssetDatabase.ExportPackage(packageFiles.ToArray(), path);
26             }
27         }
File name: frmProduct.cs Copy
306         private void button1_Click(object sender, EventArgs e)
307         {
308               try
309             {
310                 var _with1 = openFileDialog1;
311
312                 _with1.Filter = ("Image Files |*.png; *.bmp; *.jpg;*.jpeg; *.gif;");
313                 _with1.FilterIndex = 4;
314                 //Reset the file name
315                 openFileDialog1.FileName = "";
316
317                 if (openFileDialog1.ShowDialog() == DialogResult.OK)
318                 {
319                     pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
320                 }
321
322             }
323             catch (Exception ex)
324             {
325                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
326             }
327         }

Download file with original file name:PNG

PNG 135 lượt xem

Gõ tìm kiếm nhanh...