convert

Can you convert a System.Windows.Control.Image to a System.Drawing.Icon?

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The title of the question pretty much states the problem. Is it possible? 回答1: As an alternative, I've used the hints found here : public static Icon Convert(BitmapImage bitmapImage) { var ms = new MemoryStream(); var encoder = new PngBitmapEncoder(); // With this we also respect transparency. encoder.Frames.Add(BitmapFrame.Create(bitmapImage)); encoder.Save(ms); var bmp = new Bitmap(ms); return Icon.FromHandle(bmp.GetHicon()); } 回答2: I modified an example from here . This seems to work pretty good. public static Icon Convert(BitmapImage

how to convert hex to byte for the following program?

匿名 (未验证) 提交于 2019-12-03 08:56:10
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: public static String asHex ( byte buf []) { StringBuffer strbuf = new StringBuffer ( buf . length * 2 ); int i ; for ( i = 0 ; i < buf . length ; i ++) { if ((( int ) buf [ i ] & 0xff ) < 0x10 ) strbuf . append ( "0" ); strbuf . append ( Long . toString (( int ) buf [ i ] & 0xff , 16 )); } return strbuf . toString (); } 回答1: Here's a complete program which includes the asBytes() function which is what I assume you were looking for, the opposite to asHex() : public class Temp { public static String asHex ( byte buf []) {

Convert Dictionary&lt;string, object&gt; To Anonymous Object?

匿名 (未验证) 提交于 2019-12-03 08:56:10
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: First, and to make things clearer I'll explain my scenario from the top: I have a method which has the following signature: public virtual void SendEmail(String from, List recepients, Object model) What I want to do is generate an anonymous object which has the properties of the model object along with the first two parameters as well. Flattening the model object into a PropertyInfo[] is very straightforward. Accordingly, I thought of creating a Dictionary which would hold the PropertyInfo's and the first two params, and then be converted

How to convert a map location (lat, lng) pair to a screen position (x, y) pair in mapbox

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using mapbox javascript API to do some cool stuff on a map. Now I have a map location (latitude, longitude) pair and I want to set the view to this location then use javascript to simulate a click at this location. The problem is that I need to find out the screen position (x, y) pair of this location after setting the view. But how do I do that? It seems there is an API L.ICRS . I tried but it returned NaN for both x and y -- please check my example javascript codes below. var latlng = [40.444621, -79.943231] map.setView(latlng, 13); L

How to convert Gregorian string to Gregorian Calendar?

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have to compute something based on the Calendar's date, but I am receiving the complete Gregorian Calendar's String value. Eg i/p received {may be - "new GregorianCalendar().toString()"} as String :- java.util.GregorianCalendar[time=1410521241348,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/London",offset=0,dstSavings=3600000,useDaylight=true,transitions=242,lastRule=java.util.SimpleTimeZone[id=Europe/London,offset=0,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2

Convert string to UTF-8

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a string assigned to variable that's encoded as ansi, for example str = "Пирг" How can I encode it to UTF-8? 回答1: You mean when writing it to a file? Like this: Set stream = CreateObject("ADODB.Stream") stream.Open stream.Type = 2 'text stream.Position = 0 stream.Charset = "utf-8" stream.WriteText str stream.SaveToFile filename, 2 stream.Close Edit: If you want the UTF-8 string to go into another variable you could do it like this: Set stream = CreateObject("ADODB.Stream") stream.Open stream.Type = 2 'text stream.Position = 0 stream

C function to convert a raw image to png

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Is there any c function that allow me to convert a raw image to a PNG file? Preferably, I don't need to pull in a big library for that. Thank you. 回答1: I do not believe so. On the other hand, libpng isn't a huge library. 回答2: Have you tried the libpng library? http://www.libpng.org/pub/png/libpng.html 回答3: I'm not sure what you mean by "raw image", but I've found LodePNG easy to work with. http://members.gamedev.net/lode/projects/LodePNG/ There's an example showing you how to encode some raw data to a png 回答4: See a related

Convert list of lists to dataframe

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I got a nested list, named mylist which has length 4. Each element of this list is an experiment: exp1.1 , exp1.2 , exp2.1 and exp2.2 . Each experiment contains observations of length (in days) of four plant growth stages: EM-V6 V6-R0 R0-R4 and R4-R9 . Each growth stage is organized as a data frame with year and mean . Here is the complete data: mylist=structure(list(exp1.1 = structure(list(`EM-V6` = structure(list( year = 2011:2100, mean = c(34, 34, 32, 28, 25, 32, 32, 28, 27, 30, 32, 31, 33, 28, 26, 31, 33, 27, 34, 26, 28, 27, 27, 30, 29,

How to Convert Emgu.Cv.Image&lt;Gray,byte&gt; to System.Image

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was new to Emgu Cv and i was wondering if someone could let me know how i change Emgu.Cv.Image to System.Image?If there is a need for further explanation, let me know and i will do it.The language i am using is C#. 回答1: You can just use the ToImage() method to get a System.Drawing.Bitmap (which is a derived class of System.Drawing.Image ), so something like this // create an Emgu image of 400x200 filled with Blue color Image<Bgr, Byte> img = new Image<Bgr, byte>(400, 200, new Bgr(255, 0, 0)); // copy to a .NET image System.Drawing.Image

convert saved string of numbers into an array of integers

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have a comma separated string of numbers inside of a var named num_str the contents of num_str looks like this: "1,2,3,4,5" etc i am looking for a way to add num_str to an expression to convert the sting of numbers contained therein to an array of integers i want to make sure i can simply reference 'num_str' to get the numbers from instead of spelling it out like {"1,2,3,4,5"} i have tried this, where 'num_str' contains the numbers Dim test As String = Nothing Dim result() As Integer = Int32.TryParse(num_str.Split(","c)) For i = 0 To