Compare commits

..

4 Commits

Author SHA1 Message Date
zabpehely 6de5ddc4ae Update README.md 2024-01-28 20:13:41 +01:00
zabpehely e70e9eeebd Update README.md 2024-01-28 20:13:12 +01:00
Louis Lam f4eff3abb0 Update to 1.0.4 2022-11-29 18:39:24 +08:00
Louis Lam 9b376b87b6 Improve ListBox 2022-11-29 18:36:25 +08:00
8 changed files with 60 additions and 9 deletions

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]

View File

@ -68,5 +68,15 @@ namespace rdp_portal.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon icon {
get {
object obj = ResourceManager.GetObject("icon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@ -62,4 +62,7 @@
<data name="banner" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\banner.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -18,8 +18,8 @@ With RDP Portal, it is possible to save password and use it on any other Windows
## Download
From GitHub:
https://github.com/louislam/rdp-portal/releases/latest
From Here:
https://gitea.ath.cx/zabpehely/rdp-portal/releases
## FAQ

View File

@ -201,7 +201,6 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Resources\icon.ico" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
@ -209,6 +208,7 @@
<ItemGroup>
<Content Include="app.manifest" />
<Content Include="Resources\banner.png" />
<Content Include="Resources\icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\Fody.6.6.4\build\Fody.targets" Condition="Exists('packages\Fody.6.6.4\build\Fody.targets')" />

View File

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=rdp_002Dportal_002FMainForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=rdp_002Dportal_002FProperties_002FResources/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/ShowOnlyErrors/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>

View File

@ -272,13 +272,16 @@
//
this.listBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)));
this.listBox.DisplayMember = "Name";
this.listBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.listBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listBox.FormattingEnabled = true;
this.listBox.ItemHeight = 16;
this.listBox.ItemHeight = 32;
this.listBox.Location = new System.Drawing.Point(13, 107);
this.listBox.Margin = new System.Windows.Forms.Padding(4);
this.listBox.Name = "listBox";
this.listBox.Size = new System.Drawing.Size(211, 276);
this.listBox.TabIndex = 0;
this.listBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.listBox_DrawItem);
this.listBox.SelectedValueChanged += new System.EventHandler(this.listBox_SelectedValueChanged);
this.listBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox_MouseDoubleClick);
//

View File

@ -205,5 +205,39 @@ namespace RDP_Portal {
private void listBox_MouseDoubleClick(object sender, MouseEventArgs e) {
buttonConnect_Click(sender, e);
}
/**
* From https://stackoverflow.com/questions/8333282/how-can-i-include-icons-in-my-listbox
*/
private void listBox_DrawItem(object sender, DrawItemEventArgs e) {
if (e.Index == -1)
return;
e.DrawBackground();
Brush myBrush = Brushes.Black;
var iconWidth = listBox.ItemHeight;
var iconMargin = 4;
var textMargin = (iconWidth - 18) / 2;
var rect = new Rectangle(e.Bounds.X + iconMargin, e.Bounds.Y, iconWidth, iconWidth);
//assuming the icon is already added to project resources
e.Graphics.DrawIcon(rdp_portal.Properties.Resources.icon, rect);
var profile = (Profile)listBox.Items[e.Index];
e.Graphics.DrawString(
profile.Name,
e.Font,
myBrush,
new Rectangle(e.Bounds.X + iconMargin * 2 + iconWidth, e.Bounds.Y + textMargin, e.Bounds.Width, e.Bounds.Height),
StringFormat.GenericDefault
);
// If the ListBox has focus, draw a focus rectangle around the selected item.
e.DrawFocusRectangle();
}
}
}