Browse Source

修改阴影窗口的阴影层次位置(需要测试win7和xp的兼容性)

yuzhengyang 8 years ago
parent
commit
a8ea55f269

+ 13 - 0
Fork.Net/Test/Y.Test/Views/MainForm.Designer.cs

@@ -34,6 +34,7 @@
             this.TestPackForm = new System.Windows.Forms.Button();
             this.TestIconGroupForm = new System.Windows.Forms.Button();
             this.TestShadowForm = new System.Windows.Forms.Button();
+            this.TestIrrForm = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // ChineseCalendarForm
@@ -96,11 +97,22 @@
             this.TestShadowForm.UseVisualStyleBackColor = true;
             this.TestShadowForm.Click += new System.EventHandler(this.TestShadowForm_Click);
             // 
+            // TestIrrForm
+            // 
+            this.TestIrrForm.Location = new System.Drawing.Point(12, 186);
+            this.TestIrrForm.Name = "TestIrrForm";
+            this.TestIrrForm.Size = new System.Drawing.Size(262, 23);
+            this.TestIrrForm.TabIndex = 6;
+            this.TestIrrForm.Text = "TestIrrForm";
+            this.TestIrrForm.UseVisualStyleBackColor = true;
+            this.TestIrrForm.Click += new System.EventHandler(this.TestIrrForm_Click);
+            // 
             // MainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(564, 427);
+            this.Controls.Add(this.TestIrrForm);
             this.Controls.Add(this.TestShadowForm);
             this.Controls.Add(this.TestIconGroupForm);
             this.Controls.Add(this.TestPackForm);
@@ -122,5 +134,6 @@
         private System.Windows.Forms.Button TestPackForm;
         private System.Windows.Forms.Button TestIconGroupForm;
         private System.Windows.Forms.Button TestShadowForm;
+        private System.Windows.Forms.Button TestIrrForm;
     }
 }

+ 5 - 0
Fork.Net/Test/Y.Test/Views/MainForm.cs

@@ -50,5 +50,10 @@ namespace Y.Test.Views
         private void MainForm_Load(object sender, EventArgs e)
         {
         }
+
+        private void TestIrrForm_Click(object sender, EventArgs e)
+        {
+            R.Forms.GetUnique<TestIrrForm>().Show();
+        }
     }
 }

+ 102 - 0
Fork.Net/Test/Y.Test/Views/TestIrrForm.Designer.cs

@@ -0,0 +1,102 @@
+namespace Y.Test.Views
+{
+    partial class TestIrrForm
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.button1 = new System.Windows.Forms.Button();
+            this.button2 = new System.Windows.Forms.Button();
+            this.checkBox1 = new System.Windows.Forms.CheckBox();
+            this.checkBox2 = new System.Windows.Forms.CheckBox();
+            this.SuspendLayout();
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(38, 43);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 0;
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(38, 72);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(75, 148);
+            this.button2.TabIndex = 1;
+            this.button2.Text = "button2";
+            this.button2.UseVisualStyleBackColor = true;
+            // 
+            // checkBox1
+            // 
+            this.checkBox1.AutoSize = true;
+            this.checkBox1.Location = new System.Drawing.Point(155, 47);
+            this.checkBox1.Name = "checkBox1";
+            this.checkBox1.Size = new System.Drawing.Size(78, 16);
+            this.checkBox1.TabIndex = 2;
+            this.checkBox1.Text = "checkBox1";
+            this.checkBox1.UseVisualStyleBackColor = true;
+            // 
+            // checkBox2
+            // 
+            this.checkBox2.AutoSize = true;
+            this.checkBox2.BackColor = System.Drawing.Color.Transparent;
+            this.checkBox2.ForeColor = System.Drawing.Color.Yellow;
+            this.checkBox2.Location = new System.Drawing.Point(155, 72);
+            this.checkBox2.Name = "checkBox2";
+            this.checkBox2.Size = new System.Drawing.Size(78, 16);
+            this.checkBox2.TabIndex = 3;
+            this.checkBox2.Text = "checkBox2";
+            this.checkBox2.UseVisualStyleBackColor = false;
+            // 
+            // TestIrrForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackgroundImage = global::Y.Test.Properties.Resources.Rainbow;
+            this.ClientSize = new System.Drawing.Size(284, 261);
+            this.Controls.Add(this.checkBox2);
+            this.Controls.Add(this.checkBox1);
+            this.Controls.Add(this.button2);
+            this.Controls.Add(this.button1);
+            this.Name = "TestIrrForm";
+            this.Text = "TestIrrForm";
+            this.Load += new System.EventHandler(this.TestIrrForm_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.CheckBox checkBox1;
+        private System.Windows.Forms.CheckBox checkBox2;
+    }
+}

+ 25 - 0
Fork.Net/Test/Y.Test/Views/TestIrrForm.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using Y.Skin.YoForm.Irregular;
+
+namespace Y.Test.Views
+{
+    public partial class TestIrrForm : IrregularForm
+    {
+        public TestIrrForm()
+        {
+            InitializeComponent();
+        }
+
+        private void TestIrrForm_Load(object sender, EventArgs e)
+        {
+
+        }
+    }
+}

+ 120 - 0
Fork.Net/Test/Y.Test/Views/TestIrrForm.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 1 - 1
Fork.Net/Test/Y.Test/Views/TestShadowForm.Designer.cs

@@ -55,7 +55,7 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.White;
-            this.ClientSize = new System.Drawing.Size(701, 460);
+            this.ClientSize = new System.Drawing.Size(384, 239);
             this.Controls.Add(this.button2);
             this.Controls.Add(this.button1);
             this.Name = "TestShadowForm";

+ 9 - 0
Fork.Net/Test/Y.Test/Y.Test.csproj

@@ -124,6 +124,12 @@
     <Compile Include="Views\TestInputForm.Designer.cs">
       <DependentUpon>TestInputForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="Views\TestIrrForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Views\TestIrrForm.Designer.cs">
+      <DependentUpon>TestIrrForm.cs</DependentUpon>
+    </Compile>
     <Compile Include="Views\TestMove.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -188,6 +194,9 @@
     <EmbeddedResource Include="Views\TestInputForm.resx">
       <DependentUpon>TestInputForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Views\TestIrrForm.resx">
+      <DependentUpon>TestIrrForm.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Views\TestMove.resx">
       <DependentUpon>TestMove.cs</DependentUpon>
     </EmbeddedResource>

+ 1 - 0
Fork.Net/Y.Skin/YoForm/Shadow/ShadowForm.cs

@@ -26,6 +26,7 @@ namespace Y.Skin.YoForm.Shadow
             InitializeComponent();
             //SetStyles();//减少闪烁
             FormBorderStyle = FormBorderStyle.None;//设置无边框的窗口样式
+            ShowInTaskbar = false;
         }
         private void IrregularForm_Load(object sender, EventArgs e)
         {

+ 2 - 3
Fork.Net/Y.Skin/YoForm/Shadow/ShadowFormSkin.cs

@@ -26,16 +26,16 @@ namespace Y.Skin.YoForm.Shadow
             Icon = main.Icon;//设置图标
             TopMost = main.TopMost;
             FormBorderStyle = FormBorderStyle.None;//设置无边框的窗口样式
-            ShowInTaskbar = false;//使控件层显示到任务栏
+            ShowInTaskbar = true;//显示阴影层到任务栏(win10可显示缩略图)
             Size = Main.Size;//统一大小
             Width += (Main.ShadowWidth * 2);
             Height += (Main.ShadowWidth * 2);
             Main.Owner = this;//设置控件层的拥有皮肤层
+            DrawShadow();
             //SetBits();//绘制半透明不规则皮肤
         }
         private void ShadowFormSkin_Load(object sender, EventArgs e)
         {
-            DrawShadow();
         }
         #region 减少闪烁
         private void SetStyles()
@@ -77,7 +77,6 @@ namespace Y.Skin.YoForm.Shadow
                 for (int i = 0; i < Main.ShadowWidth; i++)
                 {
                     p.Color = Color.FromArgb((255 / 10 / Main.ShadowWidth) * i, c);
-                    //g.DrawRectangle(p, new Rectangle(i, i, Width - (2 * i) - 1, Height - (2 * i) - 1));
                     DrawRoundRectangle(g, p, new Rectangle(i, i, Width - (2 * i) - 1, Height - (2 * i) - 1), Main.ShadowWidth - i);
                 }
                 SetBits(bitmap);