From af570aad07bd68816272a314030b37b9dffdc6be Mon Sep 17 00:00:00 2001 From: sepa Date: Sun, 10 Jan 2016 16:09:37 +0300 Subject: [PATCH] Basic HDPI support --- SynNotes/DrawRtf.cs | 8 +- SynNotes/Form.Designer.cs | 67 ++++---- SynNotes/Form.cs | 14 +- SynNotes/Form.resx | 2 +- SynNotes/FormSync.Designer.cs | 233 ++++++++++++++-------------- SynNotes/Note.cs | 5 +- SynNotes/Program.cs | 13 +- SynNotes/Properties/AssemblyInfo.cs | 4 +- 8 files changed, 181 insertions(+), 165 deletions(-) diff --git a/SynNotes/DrawRtf.cs b/SynNotes/DrawRtf.cs index 1e92ca9..b7917c9 100644 --- a/SynNotes/DrawRtf.cs +++ b/SynNotes/DrawRtf.cs @@ -24,7 +24,12 @@ private class RichTextBoxDrawer : RichTextBox { //Convert the unit used by the .NET framework (1/100 inch) //and the unit used by Win32 API calls (twips 1/1440 inch) - private const double anInch = 14.4; + private double anInch; + public RichTextBoxDrawer() { + using(var g = this.CreateGraphics() ){ + anInch = 1440 / g.DpiX; + } + } protected override CreateParams CreateParams { get { @@ -43,7 +48,6 @@ public void Draw(Graphics graphics, Rectangle layoutArea) { rectLayoutArea.Bottom = (int)(layoutArea.Bottom * anInch); rectLayoutArea.Left = (int)(layoutArea.Left * anInch); rectLayoutArea.Right = (int)(layoutArea.Right * anInch); - IntPtr hdc = graphics.GetHdc(); SafeNativeMethods.FORMATRANGE fmtRange; diff --git a/SynNotes/Form.Designer.cs b/SynNotes/Form.Designer.cs index a8a0ee4..032dae3 100644 --- a/SynNotes/Form.Designer.cs +++ b/SynNotes/Form.Designer.cs @@ -38,8 +38,6 @@ private void InitializeComponent() this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.tree = new BrightIdeasSoftware.TreeListView(); - this.cName = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.fancyRenderer = new SynNotes.FancyRenderer(); this.cSort = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); this.treeMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components); @@ -53,10 +51,12 @@ private void InitializeComponent() this.tbFind = new System.Windows.Forms.TextBox(); this.btnLexer = new System.Windows.Forms.Label(); this.tagBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); + this.lbTags = new System.Windows.Forms.Label(); this.scEdit = new ScintillaNET.Scintilla(); this.lexerMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); + this.cName = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.fancyRenderer = new SynNotes.FancyRenderer(); trayMenu = new System.Windows.Forms.ContextMenuStrip(this.components); trayMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -116,11 +116,11 @@ private void InitializeComponent() // // splitContainer1.Panel2 // + this.splitContainer1.Panel2.Controls.Add(this.tagBox); this.splitContainer1.Panel2.Controls.Add(this.panelFind); this.splitContainer1.Panel2.Controls.Add(this.btnLexer); - this.splitContainer1.Panel2.Controls.Add(this.tagBox); - this.splitContainer1.Panel2.Controls.Add(this.label1); this.splitContainer1.Panel2.Controls.Add(this.scEdit); + this.splitContainer1.Panel2.Controls.Add(this.lbTags); this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; this.splitContainer1.Size = new System.Drawing.Size(1014, 646); this.splitContainer1.SplitterDistance = 227; @@ -152,23 +152,25 @@ private void InitializeComponent() this.tree.BackColor = System.Drawing.SystemColors.Control; this.tree.BorderStyle = System.Windows.Forms.BorderStyle.None; this.tree.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; + this.tree.CellEditUseWholeCell = false; this.tree.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.cName}); this.tree.ContextMenuStrip = this.treeMenu; this.tree.CopySelectionOnControlC = false; this.tree.EmptyListMsg = ""; - this.tree.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.tree.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.tree.FullRowSelect = true; this.tree.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.tree.HideSelection = false; - this.tree.SelectedBackColor = System.Drawing.SystemColors.Highlight; - this.tree.SelectedForeColor = System.Drawing.SystemColors.HighlightText; + this.tree.HighlightBackgroundColor = System.Drawing.SystemColors.Highlight; + this.tree.HighlightForegroundColor = System.Drawing.SystemColors.HighlightText; this.tree.IsSearchOnSortColumn = false; this.tree.Location = new System.Drawing.Point(0, 23); this.tree.Margin = new System.Windows.Forms.Padding(0); this.tree.Name = "tree"; - this.tree.OwnerDraw = true; this.tree.SelectAllOnControlA = false; + this.tree.SelectedBackColor = System.Drawing.SystemColors.Highlight; + this.tree.SelectedForeColor = System.Drawing.SystemColors.HighlightText; this.tree.ShowGroups = false; this.tree.ShowHeaderInAllViews = false; this.tree.Size = new System.Drawing.Size(227, 602); @@ -195,15 +197,6 @@ private void InitializeComponent() this.tree.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.tree_ItemDrag); this.tree.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tree_MouseClick); // - // cName - // - this.cName.AspectName = "Name"; - this.cName.AutoCompleteEditor = false; - this.cName.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None; - this.cName.FillsFreeSpace = true; - this.cName.Renderer = this.fancyRenderer; - this.cName.Text = "Name"; - // // cSort // this.cSort.AspectName = ""; @@ -372,7 +365,7 @@ private void InitializeComponent() this.tagBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; this.tagBox.BackColor = System.Drawing.SystemColors.Window; this.tagBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.tagBox.Location = new System.Drawing.Point(37, 630); + this.tagBox.Location = new System.Drawing.Point(37, 628); this.tagBox.Margin = new System.Windows.Forms.Padding(0); this.tagBox.Name = "tagBox"; this.tagBox.Size = new System.Drawing.Size(646, 13); @@ -382,18 +375,19 @@ private void InitializeComponent() this.tagBox.Enter += new System.EventHandler(this.tagBox_Enter); this.tagBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tagBox_KeyDown); // - // label1 + // lbTags // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.lbTags.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label1.BackColor = System.Drawing.SystemColors.Window; - this.label1.Location = new System.Drawing.Point(0, 624); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(683, 22); - this.label1.TabIndex = 2; - this.label1.Text = "Tags:"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lbTags.BackColor = System.Drawing.SystemColors.Window; + this.lbTags.Location = new System.Drawing.Point(0, 624); + this.lbTags.Margin = new System.Windows.Forms.Padding(0); + this.lbTags.Name = "lbTags"; + this.lbTags.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); + this.lbTags.Size = new System.Drawing.Size(683, 23); + this.lbTags.TabIndex = 2; + this.lbTags.Text = "Tags:"; + this.lbTags.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // scEdit // @@ -440,10 +434,19 @@ private void InitializeComponent() this.notifyIcon1.Visible = true; this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click); // + // cName + // + this.cName.AspectName = "Name"; + this.cName.AutoCompleteEditor = false; + this.cName.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None; + this.cName.FillsFreeSpace = true; + this.cName.Renderer = this.fancyRenderer; + this.cName.Text = "Name"; + // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(1014, 646); this.Controls.Add(this.splitContainer1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -489,7 +492,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripDropDownButton btnAdd; private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lbTags; private System.Windows.Forms.TextBox tagBox; private BrightIdeasSoftware.OLVColumn cSort; private System.Windows.Forms.ContextMenuStrip treeMenu; diff --git a/SynNotes/Form.cs b/SynNotes/Form.cs index 54aea7b..e65b79a 100644 --- a/SynNotes/Form.cs +++ b/SynNotes/Form.cs @@ -67,7 +67,7 @@ private void Form1_Move(object sender, EventArgs e) { } // inits initTree(); - initScintilla(); + initScintilla(); } } @@ -329,8 +329,8 @@ private void Form1_KeyDown(object sender, KeyEventArgs e) { // Ctrl-F else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.F) { panelFind.Left = (scEdit.LinesOnScreen >= scEdit.Lines.Count) ? - scEdit.Width - 200 : - scEdit.Width - 199 - SystemInformation.VerticalScrollBarWidth; + scEdit.Width - panelFind.Width : + scEdit.Width - panelFind.Width - SystemInformation.VerticalScrollBarWidth + 1; panelFind.Visible = true; panelFind.BringToFront(); tbFind.Focus(); @@ -454,7 +454,9 @@ private void treeAsList(string query) { //view if (tree.RowHeight < 0) { tree.Roots = null; - tree.RowHeight = 64; + using (Graphics g = this.CreateGraphics()) { + tree.RowHeight = (int)g.MeasureString("O", tree.Font).Height * 4; //title and 3 lines of preview + } tree.CanExpandGetter = null; tree.ChildrenGetter = null; tree.EmptyListMsg = ""; @@ -1886,7 +1888,7 @@ private void drawFound(Graphics g, Rectangle r, NoteItem note) { var stringSize = g.MeasureString(note.DateShort, this.Font); var offset = (int)stringSize.Height + 1; - var r2 = new Rectangle(r.X + 3, offset + 5, r.Width, r.Height - offset); //rect search result + var r2 = new Rectangle(r.X + 3, offset + 2, r.Width, r.Height - offset); //rect search result using (StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap)) { fmt.LineAlignment = StringAlignment.Near; fmt.Trimming = StringTrimming.EllipsisCharacter; @@ -1977,6 +1979,8 @@ private void drawTag(Graphics g, Rectangle r, TagItem tag) { } using (SolidBrush b = new SolidBrush(Color.White)) { fmt.Alignment = StringAlignment.Center; + fmt.LineAlignment = StringAlignment.Center; + badgerect.Y = badgerect.Y + 1; g.DrawString(tag.Count.ToString(), f, b, badgerect, fmt); //count } } diff --git a/SynNotes/Form.resx b/SynNotes/Form.resx index ea91119..b57b3cc 100644 --- a/SynNotes/Form.resx +++ b/SynNotes/Form.resx @@ -149,7 +149,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM - CwAAAk1TRnQBSQFMAgEBCgEAAbABAQGwAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CwAAAk1TRnQBSQFMAgEBCgEAAYgBAgGIAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/SynNotes/FormSync.Designer.cs b/SynNotes/FormSync.Designer.cs index 80d83de..a1eecf0 100644 --- a/SynNotes/FormSync.Designer.cs +++ b/SynNotes/FormSync.Designer.cs @@ -23,125 +23,126 @@ protected override void Dispose(bool disposing) { /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.linkCreate = new System.Windows.Forms.LinkLabel(); - this.tbEmail = new System.Windows.Forms.TextBox(); - this.tbPass = new System.Windows.Forms.TextBox(); - this.btnSave = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.cbFreq = new System.Windows.Forms.ComboBox(); - this.SuspendLayout(); - // - // linkCreate - // - this.linkCreate.AutoSize = true; - this.linkCreate.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; - this.linkCreate.Location = new System.Drawing.Point(67, 95); - this.linkCreate.Name = "linkCreate"; - this.linkCreate.Size = new System.Drawing.Size(103, 13); - this.linkCreate.TabIndex = 5; - this.linkCreate.Text = "Create new account"; - this.linkCreate.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkCreate_LinkClicked); - // - // tbEmail - // - this.tbEmail.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.linkCreate = new System.Windows.Forms.LinkLabel(); + this.tbEmail = new System.Windows.Forms.TextBox(); + this.tbPass = new System.Windows.Forms.TextBox(); + this.btnSave = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.cbFreq = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // linkCreate + // + this.linkCreate.AutoSize = true; + this.linkCreate.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; + this.linkCreate.Location = new System.Drawing.Point(67, 95); + this.linkCreate.Name = "linkCreate"; + this.linkCreate.Size = new System.Drawing.Size(103, 13); + this.linkCreate.TabIndex = 5; + this.linkCreate.TabStop = true; + this.linkCreate.Text = "Create new account"; + this.linkCreate.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkCreate_LinkClicked); + // + // tbEmail + // + this.tbEmail.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tbEmail.Location = new System.Drawing.Point(70, 15); - this.tbEmail.Name = "tbEmail"; - this.tbEmail.Size = new System.Drawing.Size(162, 20); - this.tbEmail.TabIndex = 1; - this.tbEmail.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbEmail_KeyDown); - // - // tbPass - // - this.tbPass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.tbEmail.Location = new System.Drawing.Point(70, 15); + this.tbEmail.Name = "tbEmail"; + this.tbEmail.Size = new System.Drawing.Size(171, 20); + this.tbEmail.TabIndex = 1; + this.tbEmail.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbEmail_KeyDown); + // + // tbPass + // + this.tbPass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tbPass.Location = new System.Drawing.Point(70, 41); - this.tbPass.Name = "tbPass"; - this.tbPass.Size = new System.Drawing.Size(162, 20); - this.tbPass.TabIndex = 2; - this.tbPass.UseSystemPasswordChar = true; - // - // btnSave - // - this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnSave.Location = new System.Drawing.Point(70, 127); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(88, 23); - this.btnSave.TabIndex = 4; - this.btnSave.Text = "Save"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 18); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(32, 13); - this.label1.TabIndex = 5; - this.label1.Text = "Email"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(8, 44); - this.label2.Margin = new System.Windows.Forms.Padding(3, 20, 3, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(53, 13); - this.label2.TabIndex = 6; - this.label2.Text = "Password"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(8, 70); - this.label3.Margin = new System.Windows.Forms.Padding(3, 20, 3, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(57, 13); - this.label3.TabIndex = 7; - this.label3.Text = "Frequency"; - // - // cbFreq - // - this.cbFreq.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.tbPass.Location = new System.Drawing.Point(70, 41); + this.tbPass.Name = "tbPass"; + this.tbPass.Size = new System.Drawing.Size(171, 20); + this.tbPass.TabIndex = 2; + this.tbPass.UseSystemPasswordChar = true; + // + // btnSave + // + this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSave.Location = new System.Drawing.Point(70, 130); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(88, 23); + this.btnSave.TabIndex = 4; + this.btnSave.Text = "Save"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(8, 18); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(32, 13); + this.label1.TabIndex = 5; + this.label1.Text = "Email"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(8, 44); + this.label2.Margin = new System.Windows.Forms.Padding(3, 20, 3, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(53, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Password"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(8, 70); + this.label3.Margin = new System.Windows.Forms.Padding(3, 20, 3, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(57, 13); + this.label3.TabIndex = 7; + this.label3.Text = "Frequency"; + // + // cbFreq + // + this.cbFreq.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.cbFreq.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbFreq.FormattingEnabled = true; - this.cbFreq.Location = new System.Drawing.Point(70, 67); - this.cbFreq.Name = "cbFreq"; - this.cbFreq.Size = new System.Drawing.Size(162, 21); - this.cbFreq.TabIndex = 3; - // - // SyncSetup - // - this.AcceptButton = this.btnSave; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(244, 162); - this.Controls.Add(this.cbFreq); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.btnSave); - this.Controls.Add(this.tbPass); - this.Controls.Add(this.tbEmail); - this.Controls.Add(this.linkCreate); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.KeyPreview = true; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(260, 201); - this.Name = "SyncSetup"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Simplenote Account"; - this.TopMost = true; - this.ResumeLayout(false); - this.PerformLayout(); + this.cbFreq.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbFreq.FormattingEnabled = true; + this.cbFreq.Location = new System.Drawing.Point(70, 67); + this.cbFreq.Name = "cbFreq"; + this.cbFreq.Size = new System.Drawing.Size(171, 21); + this.cbFreq.TabIndex = 3; + // + // FormSync + // + this.AcceptButton = this.btnSave; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(253, 165); + this.Controls.Add(this.cbFreq); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnSave); + this.Controls.Add(this.tbPass); + this.Controls.Add(this.tbEmail); + this.Controls.Add(this.linkCreate); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(260, 201); + this.Name = "FormSync"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Simplenote Account"; + this.TopMost = true; + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/SynNotes/Note.cs b/SynNotes/Note.cs index ab446bb..164e97b 100644 --- a/SynNotes/Note.cs +++ b/SynNotes/Note.cs @@ -225,10 +225,13 @@ public void drawTags() { } Labels.Clear(); } - f.tagBox.Left = 37; + using (Graphics g = f.CreateGraphics()) { + f.tagBox.Left = (int)g.MeasureString(f.lbTags.Text, f.lbTags.Font).Width + 5; //dpi calc + } // create labels Item.Tags.ForEach(x => drawTag(x.Name)); + f.tagBox.Width = f.btnLexer.Left - f.tagBox.Left; } /// diff --git a/SynNotes/Program.cs b/SynNotes/Program.cs index 9e603a1..1c492d7 100644 --- a/SynNotes/Program.cs +++ b/SynNotes/Program.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; -namespace SynNotes -{ - static class Program +namespace SynNotes { + static class Program { /// /// The main entry point for the application. @@ -13,9 +10,13 @@ static class Program [STAThread] static void Main() { + if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } - } + + [System.Runtime.InteropServices.DllImport("user32.dll")] + private static extern bool SetProcessDPIAware(); + } } diff --git a/SynNotes/Properties/AssemblyInfo.cs b/SynNotes/Properties/AssemblyInfo.cs index 4693bb0..f3ae012 100644 --- a/SynNotes/Properties/AssemblyInfo.cs +++ b/SynNotes/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("sepa.spb.ru")] [assembly: AssemblyProduct("SynNotes")] -[assembly: AssemblyCopyright("Copyleft © 2015")] +[assembly: AssemblyCopyright("Copyleft © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -34,5 +34,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("15.08.24.0")] +[assembly: AssemblyFileVersion("16.01.10.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")]