BVB Source Codes

PDF file browser Show PenPage.cs Source code

Return Download PDF file browser: download PenPage.cs Source code - Download PDF file browser Source code - Type:.cs
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Windows.Forms;
  7. using PdfSharp.Drawing;
  8.  
  9. namespace XDrawing.TestLab.FormPages
  10. {
  11.   /// <summary>
  12.   ///
  13.   /// </summary>
  14.   public class PenPage : System.Windows.Forms.UserControl
  15.   {
  16.     private System.Windows.Forms.Label lblWidth;
  17.     private XDrawing.TestLab.FormPages.ColorPage colorPage;
  18.     private System.Windows.Forms.NumericUpDown udWidth;
  19.     private System.Windows.Forms.ComboBox cbxStyle;
  20.     private System.Windows.Forms.ComboBox cbxLineCap;
  21.     private System.Windows.Forms.ComboBox cbxLineJoin;
  22.     private System.Windows.Forms.Label lblStyle;
  23.     private System.Windows.Forms.Label lblLineCap;
  24.     private System.Windows.Forms.Label lblLineJoin;
  25.     private System.ComponentModel.Container components = null;
  26.  
  27.     public PenPage()
  28.     {
  29.       InitializeComponent();
  30.       UITools.SetTabPageColor(this);
  31.       this.colorPage.UpdateDrawing += new UpdateDrawing(OnUpdateDrawing);
  32.     }
  33.  
  34.     void ModelToView()
  35.     {
  36.       if (this.inModelToView || DesignMode)
  37.         return;
  38.  
  39.       this.udWidth.Value = (decimal)this.penProperty.Width;
  40.       this.cbxStyle.SelectedIndex = (int)this.penProperty.DashStyle;
  41.       this.cbxLineCap.SelectedIndex = (int)this.penProperty.LineCap;
  42.       this.cbxLineJoin.SelectedIndex = (int)this.penProperty.LineJoin;
  43.       //this.cbxStyle.SelectedIndex = (int)this.penProperty.l
  44.  
  45.       this.inModelToView = false;
  46.     }
  47.     bool inModelToView;
  48.  
  49.     public event UpdateDrawing UpdateDrawing;
  50.  
  51.     void OnUpdateDrawing()
  52.     {
  53.       if (UpdateDrawing != null)
  54.         UpdateDrawing();
  55.     }
  56.  
  57.     public PenProperty PenProperty
  58.     {
  59.       get {return this.penProperty;}
  60.       set
  61.       {
  62.         this.penProperty = value;
  63.         this.colorPage.ColorProperty = value.Color;
  64.         ModelToView();
  65.       }
  66.     }
  67.     PenProperty penProperty;
  68.  
  69.     /// <summary>
  70.     /// Clean up any resources being used.
  71.     /// </summary>
  72.     protected override void Dispose(bool disposing)
  73.     {
  74.       if (disposing)
  75.       {
  76.         if (components != null)
  77.           components.Dispose();
  78.       }
  79.       base.Dispose(disposing);
  80.     }
  81.  
  82.     #region Component Designer generated code
  83.     /// <summary>
  84.     /// Required method for Designer support - do not modify
  85.     /// the contents of this method with the code editor.
  86.     /// </summary>
  87.     private void InitializeComponent()
  88.     {
  89.       this.colorPage = new XDrawing.TestLab.FormPages.ColorPage();
  90.       this.lblWidth = new System.Windows.Forms.Label();
  91.       this.udWidth = new System.Windows.Forms.NumericUpDown();
  92.       this.lblStyle = new System.Windows.Forms.Label();
  93.       this.cbxStyle = new System.Windows.Forms.ComboBox();
  94.       this.lblLineCap = new System.Windows.Forms.Label();
  95.       this.cbxLineCap = new System.Windows.Forms.ComboBox();
  96.       this.lblLineJoin = new System.Windows.Forms.Label();
  97.       this.cbxLineJoin = new System.Windows.Forms.ComboBox();
  98.       ((System.ComponentModel.ISupportInitialize)(this.udWidth)).BeginInit();
  99.       this.SuspendLayout();
  100.       //
  101.       // colorPage
  102.       //
  103.       this.colorPage.ColorProperty = null;
  104.       this.colorPage.Location = new System.Drawing.Point(0, 0);
  105.       this.colorPage.Name = "colorPage";
  106.       this.colorPage.Size = new System.Drawing.Size(380, 148);
  107.       this.colorPage.TabIndex = 0;
  108.       //
  109.       // lblWidth
  110.       //
  111.       this.lblWidth.Location = new System.Drawing.Point(12, 164);
  112.       this.lblWidth.Name = "lblWidth";
  113.       this.lblWidth.Size = new System.Drawing.Size(52, 16);
  114.       this.lblWidth.TabIndex = 1;
  115.       this.lblWidth.Text = "&Width:";
  116.       //
  117.       // udWidth
  118.       //
  119.       this.udWidth.DecimalPlaces = 1;
  120.       this.udWidth.Increment = new System.Decimal(new int[] {
  121.                                                               1,
  122.                                                               0,
  123.                                                               0,
  124.                                                               65536});
  125.       this.udWidth.Location = new System.Drawing.Point(72, 160);
  126.       this.udWidth.Name = "udWidth";
  127.       this.udWidth.Size = new System.Drawing.Size(56, 20);
  128.       this.udWidth.TabIndex = 2;
  129.       this.udWidth.ValueChanged += new System.EventHandler(this.udWidth_ValueChanged);
  130.       //
  131.       // lblStyle
  132.       //
  133.       this.lblStyle.Location = new System.Drawing.Point(12, 192);
  134.       this.lblStyle.Name = "lblStyle";
  135.       this.lblStyle.Size = new System.Drawing.Size(52, 16);
  136.       this.lblStyle.TabIndex = 1;
  137.       this.lblStyle.Text = "&Style:";
  138.       //
  139.       // cbxStyle
  140.       //
  141.       this.cbxStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  142.       this.cbxStyle.Items.AddRange(new object[] {
  143.                                                   "Solid (0)",
  144.                                                   "Dash (1)",
  145.                                                   "Dot (2)",
  146.                                                   "DashDot (3)",
  147.                                                   "DashDotDot (4)"});
  148.       this.cbxStyle.Location = new System.Drawing.Point(72, 188);
  149.       this.cbxStyle.Name = "cbxStyle";
  150.       this.cbxStyle.Size = new System.Drawing.Size(92, 21);
  151.       this.cbxStyle.TabIndex = 3;
  152.       this.cbxStyle.SelectedIndexChanged += new System.EventHandler(this.cbxStyle_SelectedIndexChanged);
  153.       //
  154.       // lblLineCap
  155.       //
  156.       this.lblLineCap.Location = new System.Drawing.Point(200, 160);
  157.       this.lblLineCap.Name = "lblLineCap";
  158.       this.lblLineCap.Size = new System.Drawing.Size(52, 16);
  159.       this.lblLineCap.TabIndex = 1;
  160.       this.lblLineCap.Text = "LineCap:";
  161.       //
  162.       // cbxLineCap
  163.       //
  164.       this.cbxLineCap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  165.       this.cbxLineCap.Items.AddRange(new object[] {
  166.                                                     "Flat (0)",
  167.                                                     "Round (1)",
  168.                                                     "Square (2)"});
  169.       this.cbxLineCap.Location = new System.Drawing.Point(260, 156);
  170.       this.cbxLineCap.Name = "cbxLineCap";
  171.       this.cbxLineCap.Size = new System.Drawing.Size(92, 21);
  172.       this.cbxLineCap.TabIndex = 3;
  173.       this.cbxLineCap.SelectedIndexChanged += new System.EventHandler(this.cbxLineCap_SelectedIndexChanged);
  174.       //
  175.       // lblLineJoin
  176.       //
  177.       this.lblLineJoin.Location = new System.Drawing.Point(200, 188);
  178.       this.lblLineJoin.Name = "lblLineJoin";
  179.       this.lblLineJoin.Size = new System.Drawing.Size(52, 16);
  180.       this.lblLineJoin.TabIndex = 1;
  181.       this.lblLineJoin.Text = "&LineJoin:";
  182.       //
  183.       // cbxLineJoin
  184.       //
  185.       this.cbxLineJoin.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  186.       this.cbxLineJoin.Items.AddRange(new object[] {
  187.                                                      "Miter (0)",
  188.                                                      "Round (1)",
  189.                                                      "Bevel (2)"});
  190.       this.cbxLineJoin.Location = new System.Drawing.Point(260, 184);
  191.       this.cbxLineJoin.Name = "cbxLineJoin";
  192.       this.cbxLineJoin.Size = new System.Drawing.Size(92, 21);
  193.       this.cbxLineJoin.TabIndex = 3;
  194.       this.cbxLineJoin.SelectedIndexChanged += new System.EventHandler(this.cbxLineJoin_SelectedIndexChanged);
  195.       //
  196.       // PenPage
  197.       //
  198.       this.BackColor = System.Drawing.SystemColors.Control;
  199.       this.Controls.Add(this.cbxStyle);
  200.       this.Controls.Add(this.udWidth);
  201.       this.Controls.Add(this.lblWidth);
  202.       this.Controls.Add(this.colorPage);
  203.       this.Controls.Add(this.lblStyle);
  204.       this.Controls.Add(this.lblLineCap);
  205.       this.Controls.Add(this.cbxLineCap);
  206.       this.Controls.Add(this.lblLineJoin);
  207.       this.Controls.Add(this.cbxLineJoin);
  208.       this.Name = "PenPage";
  209.       this.Size = new System.Drawing.Size(380, 240);
  210.       ((System.ComponentModel.ISupportInitialize)(this.udWidth)).EndInit();
  211.       this.ResumeLayout(false);
  212.  
  213.     }
  214.     #endregion
  215.  
  216.     protected override void OnLoad(EventArgs e)
  217.     {
  218.       base.OnLoad (e);
  219.       ModelToView();
  220.     }
  221.  
  222.     private void udWidth_ValueChanged(object sender, System.EventArgs e)
  223.     {
  224.       if (this.inModelToView)
  225.         return;
  226.       this.penProperty.Width = Convert.ToSingle(this.udWidth.Value);
  227.       OnUpdateDrawing();
  228.     }
  229.  
  230.     private void cbxStyle_SelectedIndexChanged(object sender, System.EventArgs e)
  231.     {
  232.       if (this.inModelToView)
  233.         return;
  234.       this.penProperty.DashStyle = (XDashStyle)this.cbxStyle.SelectedIndex;
  235.       OnUpdateDrawing();
  236.     }
  237.  
  238.     private void cbxLineCap_SelectedIndexChanged(object sender, System.EventArgs e)
  239.     {
  240.       if (this.inModelToView)
  241.         return;
  242.       this.penProperty.LineCap = (XLineCap)this.cbxLineCap.SelectedIndex;
  243.       OnUpdateDrawing();
  244.     }
  245.  
  246.     private void cbxLineJoin_SelectedIndexChanged(object sender, System.EventArgs e)
  247.     {
  248.       if (this.inModelToView)
  249.         return;
  250.       this.penProperty.LineJoin = (XLineJoin)this.cbxLineJoin.SelectedIndex;
  251.       OnUpdateDrawing();
  252.     }
  253.   }
  254. }
  255.  
downloadPenPage.cs Source code - Download PDF file browser Source code
Related Source Codes/Software:
Campus id - This system includes a campus dormitory management... 2015-04-10
ShopXP online system source code - ShopXP ShoppingNet online system source code infor... 2015-04-10
TOM cat demo in learning to speak - 实现汤米猫学说话的演示,即实现变声功能鲜豔,,,,,,,开发者说:自己经常来看code4app,看看... 2015-04-10
Another OpenFolder - Implements can commence in the middle of the scree... 2015-04-10
Bus query system - A simple bus query system. Can be divided into rou... 2015-04-10
Customer service management system - To a store and development of customer service man... 2015-04-10
OA office automation system - OA office automation system is tomorrow technology... 2015-04-10
Chapters novel divider (ChapCuttor) - Chapter divider (ChapCuttor) by & have spent Black... 2015-04-10
Graduation design file (graphics algorithm design) - Reference image effect algorithm design the softwa... 2015-04-10
CheatEngine5.6 source code - Game cheat the 5.6 version of the source code, it ... 2015-04-10
Online ZhaXunWang science formula query V1.0 - Including junior middle school and high school sci... 2016-10-20
Observe science formula query v1.0 - Observe network science formulas 2016-10-20
Lele v1.1 QQ login system - "Le Le QQ Group landing system Ver1.1" * Fix QQ ... 2016-10-20
The new network domain name host distribution system V1.0 - Use Notepad to open \Global.asa idc1688 into your ... 2016-10-20
QQ group v2.1 release system - ha ha - "Copyright" This system is based on the Wu Meng de... 2016-10-20
Interesting content ASPCMS v1.0 - Update log: 2016-10-20
Residential feng shui fortune-telling v1.0 - The project according to the orientation of the ar... 2016-10-20
The self-help chain home beautiful - The self-help chain home beautiful 2016-10-20
EXW FLASH web site management system v2.0 - EXW FLASH introduction: EXW website management sys... 2016-10-20
WAP2.0 web site management system V1.0 - System installation steps 1, install the QuickWAP ... 2016-10-20

 Back to top