1 // OpenTween - Client of Twitter
2 // Copyright (c) 2013 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3 // All rights reserved.
5 // This file is part of OpenTween.
7 // This program is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by the Free
9 // Software Foundation; either version 3 of the License, or (at your option)
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 // You should have received a copy of the GNU General Public License along
18 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20 // Boston, MA 02110-1301, USA.
23 using System.Collections.Generic;
26 using System.Windows.Forms;
27 using System.ComponentModel;
29 using System.Threading.Tasks;
30 using System.Threading;
36 public class OTPictureBox : PictureBox
39 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
40 public new MemoryImage Image
42 get { return this.memoryImage; }
45 this.memoryImage = value;
46 base.Image = value != null ? value.Image : null;
48 this.RestoreSizeMode();
51 private MemoryImage memoryImage;
54 [DefaultValue(PictureBoxSizeMode.Normal)]
55 public new PictureBoxSizeMode SizeMode
57 get { return this.currentSizeMode; }
60 this.currentSizeMode = value;
62 if (base.Image != base.InitialImage && base.Image != base.ErrorImage)
64 base.SizeMode = value;
70 /// InitialImage や ErrorImage の表示に SizeMode を一時的に変更するため、
71 /// 現在の SizeMode を記憶しておくためのフィールド
73 private PictureBoxSizeMode currentSizeMode;
75 public void ShowInitialImage()
77 base.Image = base.InitialImage;
79 // InitialImage は SizeMode の値に依らず中央等倍に表示する必要がある
80 base.SizeMode = PictureBoxSizeMode.CenterImage;
83 public void ShowErrorImage()
85 base.Image = base.ErrorImage;
87 // ErrorImage は SizeMode の値に依らず中央等倍に表示する必要がある
88 base.SizeMode = PictureBoxSizeMode.CenterImage;
91 private void RestoreSizeMode()
93 base.SizeMode = this.currentSizeMode;
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
99 public new string ImageLocation
101 get { throw new NotImplementedException(); }
102 set { throw new NotImplementedException(); }
105 [EditorBrowsable(EditorBrowsableState.Never)]
106 public new void Load(string url)
108 throw new NotImplementedException();