svnno****@sourc*****
svnno****@sourc*****
2010年 10月 29日 (金) 20:26:34 JST
Revision: 1006 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1006 Author: syo68k Date: 2010-10-29 20:26:34 +0900 (Fri, 29 Oct 2010) Log Message: ----------- rev戻しすぎでAPI表示が切れるようになってしまっていたのを修正 Modified Paths: -------------- trunk/Tween/ToolStripAPIGauge.vb trunk/Tween/Tween.Designer.vb trunk/Tween/Tween.resx -------------- next part -------------- Modified: trunk/Tween/ToolStripAPIGauge.vb =================================================================== --- trunk/Tween/ToolStripAPIGauge.vb 2010-10-29 04:24:38 UTC (rev 1005) +++ trunk/Tween/ToolStripAPIGauge.vb 2010-10-29 11:26:34 UTC (rev 1006) @@ -5,10 +5,14 @@ Public Class ToolStripAPIGauge Inherits ToolStripControlHost + Private originalSize As Size + Public Sub New() MyBase.New(New Control()) Me.AutoToolTip = True AddHandler Me.Control.Paint, AddressOf Draw + AddHandler Me.Control.TextChanged, AddressOf Control_TextChanged + AddHandler Me.Control.SizeChanged, AddressOf Control_SizeChanged End Sub Private _gaugeHeight As Integer @@ -26,6 +30,7 @@ Public Property MaxCount As Integer Set(ByVal value As Integer) Me._maxCount = value + Me.SetText(Me._remainCount, Me._maxCount) Me.Control.Refresh() End Set Get @@ -37,6 +42,7 @@ Public Property RemainCount As Integer Set(ByVal value As Integer) Me._remainCount = value + Me.SetText(Me._remainCount, Me._maxCount) Me.Control.Refresh() End Set Get @@ -61,22 +67,6 @@ End Property Private Sub Draw(ByVal sender As Object, ByVal e As PaintEventArgs) - Dim textFormat As String = "API {0}/{1}" - Dim text As String - If Me._remainCount > -1 AndAlso Me._maxCount > -1 Then - ' 正常 - text = String.Format(textFormat, Me._remainCount, Me._maxCount) - ElseIf Me.RemainCount > -1 Then - ' uppercount不正 - text = String.Format(textFormat, Me._remainCount, "???") - ElseIf Me._maxCount < -1 Then - ' remaincount不正 - text = String.Format(textFormat, "???", Me._maxCount) - Else - ' 両方とも不正 - text = String.Format(textFormat, "???", "???") - End If - Dim minute As Double = (Me.ResetTime - DateTime.Now).TotalMinutes Dim apiGaugeBounds As New Rectangle(0, _ CType((Me.Control.Height - (Me._gaugeHeight * 2)) / 2, Integer), _ @@ -89,6 +79,37 @@ e.Graphics.FillRectangle(Brushes.LightBlue, apiGaugeBounds) e.Graphics.FillRectangle(Brushes.LightPink, timeGaugeBounds) - e.Graphics.DrawString(text, Me.Control.Font, SystemBrushes.ControlText, 0, CType(timeGaugeBounds.Top - (Me.Control.Font.Height / 2), Single)) + e.Graphics.DrawString(Me.Control.Text, Me.Control.Font, SystemBrushes.ControlText, 0, CType(timeGaugeBounds.Top - (Me.Control.Font.Height / 2), Single)) End Sub + + Private Sub Control_TextChanged(ByVal sender As Object, ByVal e As EventArgs) + RemoveHandler Me.Control.SizeChanged, AddressOf Me.Control_SizeChanged + Using g As Graphics = Me.Control.CreateGraphics() + Me.Control.Size = New Size(CType(Math.Max(g.MeasureString(Me.Control.Text, Me.Control.Font).Width, Me.originalSize.Width), Integer), _ + Me.Control.Size.Height) + End Using + AddHandler Me.Control.SizeChanged, AddressOf Me.Control_SizeChanged + End Sub + + Private Sub Control_SizeChanged(ByVal sender As Object, ByVal e As EventArgs) + Me.originalSize = Me.Control.Size + End Sub + + Private Sub SetText(ByVal remain As Integer, ByVal max As Integer) + Dim textFormat As String = "API {0}/{1}" + + If Me._remainCount > -1 AndAlso Me._maxCount > -1 Then + ' 正常 + Me.Control.Text = String.Format(textFormat, Me._remainCount, Me._maxCount) + ElseIf Me.RemainCount > -1 Then + ' uppercount不正 + Me.Control.Text = String.Format(textFormat, Me._remainCount, "???") + ElseIf Me._maxCount < -1 Then + ' remaincount不正 + Me.Control.Text = String.Format(textFormat, "???", Me._maxCount) + Else + ' 両方とも不正 + Me.Control.Text = String.Format(textFormat, "???", "???") + End If + End Sub End Class \ No newline at end of file Modified: trunk/Tween/Tween.Designer.vb =================================================================== --- trunk/Tween/Tween.Designer.vb 2010-10-29 04:24:38 UTC (rev 1005) +++ trunk/Tween/Tween.Designer.vb 2010-10-29 11:26:34 UTC (rev 1006) @@ -28,6 +28,7 @@ Me.ToolStripContainer1 = New System.Windows.Forms.ToolStripContainer() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.StatusLabelUrl = New System.Windows.Forms.ToolStripStatusLabel() + Me.StatusLabel = New Tween.TweenCustomControl.ToolStripLabelHistory() Me.HashStripSplitButton = New System.Windows.Forms.ToolStripSplitButton() Me.ContextMenuPostMode = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ToolStripMenuItemUrlMultibyteSplit = New System.Windows.Forms.ToolStripMenuItem() @@ -265,7 +266,6 @@ Me.TimerRefreshIcon = New System.Windows.Forms.Timer(Me.components) Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) - Me.StatusLabel = New Tween.TweenCustomControl.ToolStripLabelHistory() Me.ToolStripContainer1.BottomToolStripPanel.SuspendLayout() Me.ToolStripContainer1.ContentPanel.SuspendLayout() Me.ToolStripContainer1.TopToolStripPanel.SuspendLayout() @@ -332,6 +332,14 @@ Me.StatusLabelUrl.Name = "StatusLabelUrl" Me.StatusLabelUrl.Spring = True ' + 'StatusLabel + ' + Me.StatusLabel.BorderSides = CType((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right), System.Windows.Forms.ToolStripStatusLabelBorderSides) + Me.StatusLabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text + Me.StatusLabel.DoubleClickEnabled = True + Me.StatusLabel.Name = "StatusLabel" + resources.ApplyResources(Me.StatusLabel, "StatusLabel") + ' 'HashStripSplitButton ' Me.HashStripSplitButton.AutoToolTip = False @@ -345,6 +353,7 @@ ' Me.ContextMenuPostMode.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItemUrlMultibyteSplit, Me.ToolStripMenuItemApiCommandEvasion, Me.ToolStripMenuItemUrlAutoShorten, Me.IdeographicSpaceToSpaceToolStripMenuItem, Me.MultiLineMenuItem, Me.ToolStripFocusLockMenuItem, Me.ToolStripSeparator35, Me.ImageSelectMenuItem, Me.ToolStripSeparator8, Me.HashToggleMenuItem, Me.HashManageMenuItem}) Me.ContextMenuPostMode.Name = "ContextMenuStripPostMode" + Me.ContextMenuPostMode.OwnerItem = Me.HashStripSplitButton resources.ApplyResources(Me.ContextMenuPostMode, "ContextMenuPostMode") ' 'ToolStripMenuItemUrlMultibyteSplit @@ -1650,14 +1659,6 @@ ' Me.OpenFileDialog1.FileName = "OpenFileDialog1" ' - 'StatusLabel - ' - Me.StatusLabel.BorderSides = CType((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right), System.Windows.Forms.ToolStripStatusLabelBorderSides) - Me.StatusLabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text - Me.StatusLabel.DoubleClickEnabled = True - Me.StatusLabel.Name = "StatusLabel" - resources.ApplyResources(Me.StatusLabel, "StatusLabel") - ' 'TweenMain ' Me.AllowDrop = True Modified: trunk/Tween/Tween.resx =================================================================== --- trunk/Tween/Tween.resx 2010-10-29 04:24:38 UTC (rev 1005) +++ trunk/Tween/Tween.resx 2010-10-29 11:26:34 UTC (rev 1006) @@ -130,7 +130,7 @@ </data> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="StatusLabelUrl.Size" type="System.Drawing.Size, System.Drawing"> - <value>313, 22</value> + <value>344, 22</value> </data> <data name="StatusLabelUrl.Text" xml:space="preserve"> <value>ToolStripStatusLabel1</value> @@ -2442,6 +2442,12 @@ <data name=">>StatusLabelUrl.Type" xml:space="preserve"> <value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </data> + <data name=">>StatusLabel.Name" xml:space="preserve"> + <value>StatusLabel</value> + </data> + <data name=">>StatusLabel.Type" xml:space="preserve"> + <value>Tween.TweenCustomControl.ToolStripLabelHistory, Tween, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null</value> + </data> <data name=">>HashStripSplitButton.Name" xml:space="preserve"> <value>HashStripSplitButton</value> </data> @@ -3672,12 +3678,6 @@ <data name=">>ToolTip1.Type" xml:space="preserve"> <value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </data> - <data name=">>StatusLabel.Name" xml:space="preserve"> - <value>StatusLabel</value> - </data> - <data name=">>StatusLabel.Type" xml:space="preserve"> - <value>Tween.TweenCustomControl.ToolStripLabelHistory, Tween, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null</value> - </data> <data name=">>$this.Name" xml:space="preserve"> <value>TweenMain</value> </data>