diff --git a/AnimationEditor/Form1.Designer.cs b/AnimationEditor/Form1.Designer.cs index 7470189..ef59d90 100644 --- a/AnimationEditor/Form1.Designer.cs +++ b/AnimationEditor/Form1.Designer.cs @@ -91,8 +91,8 @@ this.animationPanel = new System.Windows.Forms.Panel(); this.animationNameLabel = new System.Windows.Forms.Label(); this.animationLabel = new System.Windows.Forms.Label(); - this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog(); this.animationPreview = new AnimationEditor.AnimationPreview(); + this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog(); ((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit(); this.mainMenuStrip.SuspendLayout(); @@ -136,12 +136,14 @@ this.frameListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.frameListBox.BackColor = System.Drawing.SystemColors.Window; + this.frameListBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.frameListBox.FormattingEnabled = true; this.frameListBox.Location = new System.Drawing.Point(163, 41); this.frameListBox.Name = "frameListBox"; this.frameListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.frameListBox.Size = new System.Drawing.Size(120, 160); this.frameListBox.TabIndex = 4; + this.frameListBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.frameListBox_DrawItem); this.frameListBox.SelectedIndexChanged += new System.EventHandler(this.frameListBox_SelectedIndexChanged); // // addSpriteToFrameListButton @@ -777,12 +779,6 @@ this.animationLabel.TabIndex = 22; this.animationLabel.Text = "Animation"; // - // loadAnimationSetDialog - // - this.loadAnimationSetDialog.DefaultExt = "animset"; - this.loadAnimationSetDialog.FileName = "openFileDialog1"; - this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet"; - // // animationPreview // this.animationPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -803,6 +799,12 @@ this.animationPreview.ZoomLevel = 0F; this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel); // + // loadAnimationSetDialog + // + this.loadAnimationSetDialog.DefaultExt = "animset"; + this.loadAnimationSetDialog.FileName = "openFileDialog1"; + this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/AnimationEditor/Form1.cs b/AnimationEditor/Form1.cs index 8e57012..ad77a26 100644 --- a/AnimationEditor/Form1.cs +++ b/AnimationEditor/Form1.cs @@ -793,5 +793,43 @@ namespace AnimationEditor frameNameBoxEdited = true; } } + + private void frameListBox_DrawItem(object sender, DrawItemEventArgs e) + { + // Draw the background of the ListBox control for each item. + //e.DrawBackground(); + // Define the default color of the brush as black. + Brush nameBrush = Brushes.Black; + Brush indexBrush = Brushes.Gray; + + if (e.BackColor.GetBrightness() < 0.5) + nameBrush = Brushes.White; + + System.Drawing.Rectangle indexRect = e.Bounds; + System.Drawing.Rectangle nameRect = e.Bounds; + indexRect.Width = 26; + nameRect.X += 24; + nameRect.Width -= 24; + + string indexString = ""; + for(int index = 3 - e.Index.ToString().Length; index > 0; index--) + { + indexString += "0"; + } + indexString += e.Index; + indexString += ":"; + + e.Graphics.FillRectangle(Brushes.White, indexRect); + e.Graphics.FillRectangle(new SolidBrush(e.BackColor), nameRect); + // Draw the current item text based on the current Font + // and the custom brush settings. + e.Graphics.DrawString(indexString, + e.Font, indexBrush, indexRect, StringFormat.GenericDefault); + + e.Graphics.DrawString(frames[e.Index].Name, + e.Font, nameBrush, nameRect, StringFormat.GenericDefault); + // If the ListBox has focus, draw a focus rectangle around the selected item. + e.DrawFocusRectangle(); + } } }