xxKralTRxx
Picopat
- Katılım
- 31 Temmuz 2022
- Mesajlar
- 342
- Çözümler
- 6
Özellikle button1_Click kısmının içerisindeki ve public string video kısmının içerisindeki yazılanlar ne anlama geliyor pek anlayamadım.
C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp11
{
public partial class Form1 : Form
{
string _url;
public string VideoID
{
get
{
var yMATCH = new Regex(@"http(?:s?)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)([\w\-]+)(&(amp;)?[\w\?=]*)?").Match(_url);
return yMATCH.Success? yMATCH.Groups[1].Value : string.Empty;
}
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
_url = textBox1.Text;
webBrowser1.DocumentText = string.Format("<Meta http-equiv=\"X-UA-Compatible\" Content=\"IE=EDGE\" />" +
"<iframe width =\"100%\" height =\"315\" src =\"https://www.youtube.com/embed/{0}?autoplay=1 \"" +
" frameborder = \"0\" allow = \"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen ></ iframe >", VideoID);
}
}
}