Without seeing any code I don't know if this will help. I fixed this problem in VB by converting the icon to a bitmap with the routine below. I also use ExtractIconEx. I found that icon.ToBitmap() loses resolution for some reason. Sorry, you'll have to convert to C#.
''' Convert Icon to Bitmap with resizing.
''' <param name="ic"></param>
''' <param name="sz"></param>
Public Shared Function IconToBitmap(ByVal ic As Icon, ByVal sz As Size) As Bitmap
If ic Is Nothing Then Return Nothing
Dim sourceWidth As Integer = ic.Width
Dim sourceHeight As Integer = ic.Height
Dim dPercent As Double = 0
Dim dPercentW As Double = 0
Dim dPercentH As Double = 0
If (dPercentH < dPercentW) Then
dPercent = dPercentH
dPercent = dPercentW
Dim destWidth As Integer = (sourceWidth * dPercent)
Dim destHeight As Integer = (sourceHeight * dPercent)
Dim bm As Bitmap = New Bitmap(destWidth, destHeight, PixelFormat.Format32bppArgb)
Dim g As Graphics = Graphics.FromImage(bm)
'g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
' This gives the best quality
g.InterpolationMode = Drawing2D.InterpolationMode.NearestNeighbor
g.DrawIcon(ic, New Rectangle(0, 0, destWidth, destHeight))
I have got some assembly in my sub folder and I know how to load it.
The problem is with other assemblies in this folder that this assembly is depending on.
I'm guessing that application would search for them only in it's own directory when loading assembly and not at assembly location.
Now I know about AppDomain.AssemblyResolve, but how can I subscribe to it in my assembly so I don't have to mess around with it in my main application.
Or how can I load all dependent assemblies when my assembly is loaded.
I have the following table, i can join this table to others to build a bigger dataset but I only wnat to run one query to get the data and then build a data model shown below. I can build a Single model but i want to do more like a JSON serialization.
Can anybody show me a LINQ or other method that would be efficient and could be expanded to use generics?
School Class Student
Bakers 19A Bob
Bakers 19A Jim
Bakers 17A Gary
Bakers 17A Stuart
here is another example data set, i want to go one more level down and group by username and EventTime, but i don't know how to expand the linq, plus i will have to remove the time stamp from the event dattime
Notice: Never mind the space in the middle of "address" for the first and second TextBlock. The code-view here at CodeProject failes to display the address. It tries, and fails, to fetch the correct symbols by that address - if I remove the space in the addresses...
The result are displayed in the four TextBlocks. From top to bottom:
* First: This fails. I get an empty rectangle, like these rectangles.
* Second: This line works. You should be able to copy this line into your own application with success.
* Third: Same as the first TextBlock. An empty rectangle.
* Forth: This "works". I get the correct symbol as well as an empty rectangle.
Thanks for the reply.
Unfortunately it didn't work. Changing the syntax for the reference of the Font didn't solve the problem. Thanks for suggesting that anyway. It was worth a try.
For this question I have created a simple application where the Fonts are stored in the same project as my executable. I can reproduce the error in this small application for myself and to post in this forum.
In my real project I have all this is in a WPF User Control Library. That is way I have the exact path to the font with the assembly reference.
In the code, I have tried these different ways to set the FontFamily property. I have just listed them here. But have run them separately. All failed...
privatevoid Window_Loaded(object sender, RoutedEventArgs e)
txt1.FontFamily = new FontFamily("pack://application:,,,/Main;component/Fonts/#MyFont");
txt1.FontFamily = new FontFamily(new Uri("pack://application:,,,/Fonts/"), "./#MyFont");
txt1.FontFamily = new FontFamily("MyFont");
txt1.Text = "\xe905";
Notice the txt1.FontFamily = new FontFamily("MyFont");
I have installed the font from it's ttf-file.
If I open the Character map application in Windows I can see all symbols that I require.
I just can't understand what is going on...
Last Visit: 31-Dec-99 18:00 Last Update: 21-Sep-23 17:12