OSDN Git Service

アニメーション Gif 再生中に ExternalException が発生する問題の対策
[opentween/open-tween.git] / OpenTween / OTPictureBox.cs
index 0e35812..17162b4 100644 (file)
@@ -22,6 +22,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Windows.Forms;
 using System.ComponentModel;
@@ -93,6 +94,20 @@ namespace OpenTween
             base.SizeMode = this.currentSizeMode;
         }
 
+        protected override void OnPaint(PaintEventArgs pe)
+        {
+            try
+            {
+                base.OnPaint(pe);
+            }
+            catch (ExternalException)
+            {
+                // アニメーション GIF 再生中に発生するエラーの対策
+                // 参照: https://sourceforge.jp/ticket/browse.php?group_id=6526&tid=32894
+                this.ShowErrorImage();
+            }
+        }
+
         [Browsable(false)]
         [EditorBrowsable(EditorBrowsableState.Never)]
         [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]