Posts
[VB.NET]取得Gif動畫圖檔內含的圖片
Private Sub btnFileBrowser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFileBrowser.Click If Me.OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Me.tbxGifFile.Text = Me.OpenFileDialog1.FileName SplitGifFrame(New Bitmap(Me.tbxGifFile.Text)) End If End Sub Private Sub SplitGifFrame(ByVal gifBmp As Bitmap) Me.flpGifFrames.Controls.Clear() Dim gifFrames() As Bitmap = GetGifFrames(gifBmp) flpGifFrames.SuspendLayout() For Each frame As Bitmap In gifFrames flpGifFrames.Controls.Add(New PictureBox With {.Image = frame}) Next flpGifFrames.ResumeLayout() Me.tsslStatus.Text = My.Computer.FileSystem.GetName(Me.tbxGifFile.Text) & " 內含 " & gifFrames.Count.ToString & " 個圖片" End Sub Private Function GetGifFrames(ByVal gifBmp As Bitmap) As Bitmap() Dim imgFrmDim As Imaging.
read morePosts
[C#][VB.NET]FullScreen the winform
static class FullScreenExtension { #region Struct struct FullScreenData { public FormBorderStyle FormBorderStyle { get; set; } public FormWindowState WindowState { get; set; }
public FullScreenData(FormBorderStyle formBorderStyle, FormWindowState windowState):this() { this.FormBorderStyle = formBorderStyle; this.WindowState = windowState; } } #endregion #region Var private static Dictionary<Form, FullScreenData> _fullScreenDataPool; #endregion #region Private Property private static Dictionary<Form, FullScreenData> m_FullScreenDataPool { get { if (_fullScreenDataPool == null) _fullScreenDataPool = new Dictionary<Form, FullScreenData>(); return _fullScreenDataPool; } } #endregion #region Public Method public static void FullScreen(this Form frm) { if (m_FullScreenDataPool.
read morePosts
[VB.NET]為控制項加上顯示載入動畫的機制
#End Region
Public Module ControlLoadingExtension
#Region “Class” Class LoadingInfo Private _loaddingBmp As Image Private _loaddingBmpActiveFrameIdx As Integer Private _loaddingBmpDimension As FrameDimension Private _loaddingBmpFrameCount As Integer Private _displayLocation As Point
Property LoaddingBmp As Image Get Return _loaddingBmp End Get Set(ByVal value As Image) If _loaddingBmp IsNot value Then _loaddingBmp = value LoaddingBmpDimension = New FrameDimension(value.FrameDimensionsList(0)) LoaddingBmpFrameCount = value.GetFrameCount(LoaddingBmpDimension) LoaddingBmpActiveFrameIdx = 0 End If End Set End Property Property LoaddingBmpActiveFrameIdx As Integer Get Return _loaddingBmpActiveFrameIdx End Get Set(ByVal value As Integer) _loaddingBmpActiveFrameIdx = value LoaddingBmp.
read morePosts
[VB.NET]Change MDI Parent BackColor
Private Sub SetMdiBackColor() For Each c As Control In Me.Controls If TypeOf c Is MdiClient Then c.BackColor = Me.BackColor Exit For End If Next End Sub End Class
Private Sub SetMdiBackColor() Me.Controls(Me.Controls.Count - 1).BackColor = Me.BackColor End Sub End Class
read morePosts
[VS 2010]Generate From Usage
namespace Generate_From_Usage { class Person { } } Generate Property當物件的屬性不存在時,我們可透過Generate From Usage的Generate Property來替我們產生。 使用後,會幫我們產生對應的屬性 using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Generate_From_Usage { class Person { public string Name { get; set; } } } 若要產生靜態的屬性,我們可以透過"類別.屬性名稱"來作Generate Property 使用後,靜態的屬性就產生了 using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Generate_From_Usage { class Person { public string Name { get; set; } public static string StaticProperty { get; set; } } } Generate Field當物件的欄位不存在時,我們可透過Generate From Usage的Generate Field來替我們產生。 使用後,會幫我們產生對應的欄位 using System; using System.
read more