字幕を自動的に提供するライブラリを使用せずに、メディア ファイルに字幕を挿入したい (DirectShow のように)
ウィンドウ デスクトップの描画ハンドルを使って描画する方法を使用しましたが、うまくいきませんでした。更新の速さのせいだと思いますが…ですよね?とにかく、メディア ファイルをペイントしたり、オーバーレイ ハンドルを取得したりする機能や方法はありますか?
[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
static extern IntPtr GetDCEx(IntPtr hwnd, IntPtr hrgn, uint flags);
[DllImport("user32.dll")]
static extern IntPtr ReleaseDC(IntPtr hwnd, IntPtr hdc);
public void SubtitleDraw()
{
IntPtr hWnd = GetDesktopWindow();
IntPtr hDc = GetDCEx(hWnd, IntPtr.Zero, 1027);
Font font1 = new Font("Times New Roman", 24, FontStyle.Regular,GraphicsUnit.Pixel);
Point pt = new Point(40, 375);
PointF pointF1 = new PointF();
pointF1 = PlayerForm.ActiveForm.PointToScreen(pt);
Graphics g = Graphics.FromHdc(hDc);
g.DrawString(SubtitleText, font1, Brushes.Black, pointF1);
ReleaseDC(hWnd, hDc);
}