Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
I

iliyang

@iliyang
About
Posts
26
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to create custom elements for inclusion in FlowDocument (need a general direction for literature) [modified]
    I iliyang

    Hi all, I want to write a small note taking application that would allow to embed LaTeX formulas (as images) in the text. So far I have the functionality to generate a raster image given a piece of LaTeX code. The existing formatting functionality of the RichTextBox is more than enough for me and the only thing I need now is one custom inline element and one custom block element. These have to store both the LaTeX code and a cached image (which could be updated on demand). They also need to have a few custom properties (maybe XAML-visible) and to be able to serialize both the LaTeX code and the image into a XAML file. My problem is that I don't know where to look for information on how to create custom document elements and more generally custom classes that can integrate in XAML (e.g. how to expose their properties to XAML, how to serialize them). Any directions will be greatly appreciated! Maybe there are also some useful CodeProject articles on these topics? Thanks a lot in advance! EDIT: OK, I found info in books on how to deal with dependency properties and XAML. But still no good info on how to create custom document elements. What events are fired, how serialization is performed, and moreover how to handle these with custom elements.

    modified on Thursday, July 15, 2010 6:56 AM

    WCF and WF wpf json help tutorial question

  • web file properties
    I iliyang

    Well, it is all done using the HTTP headers. One tells you the Content-Length, other tells you the Content-Type, etc. And wneh you make an HTTP request, using another HTTP header (don't remember the exact name) you can tell the offset from which you want to receive tha data. That's it. Just find e good HTTP reference and you'll be OK. Cheers ;)

    C# question json

  • ListView and LVM_GETSUBITEMRECT problem, help please :(
    I iliyang

    I'm stuck. I'm writing a custom drawn ListView and I need to draw the subitems of each item. So the cleanest way to get the subitem bounds is to send an LVM_GETSUBITEMRECT message. But it works well only for indexes greater than 0. This is also noted in MSDN. The big trouble comes when the columns are reordered by the user. No matter what, LVM_GETSUBITEMRECT for index 0 always returns the bounds, as if it was the leftmost column. For all other indexes LVM_GETSUBITEMRECT always works fine in every case. How should I get the proper bounds for subitems at index 0?

    C# help database question

  • ListView - Columns collection design-time question
    I iliyang

    I'm subclassing the ColumnHeader (named MyColumnHeader for instance) class and I want when I click the "Add" button in the Columns designer window a MyColumnHeader object to be added to the collection, and not a ColumnHeader object. I.e. I want to go round the writing of a custom collection for MyColumnHeader items, 'cause it's too complicated. Is this possible? Thanks.

    C# question design

  • Importing Macros from C header files?
    I iliyang

    OK, thanks for both replies. The hidden idea in the question was also to find someone that has already done that ;)

    C# csharp question winforms linux

  • Parsing IL
    I iliyang

    Look here: http://www.aisto.com/roeder/dotnet/[^] It is just the best "reflecting" and decompiler program - a must-have! ;) You can explore the code and resources of any assembly in (almost) every .net language you want!

    C# csharp dotnet json question

  • Now Im really irritated!!
    I iliyang

    OK, as I understand, you have a byte array (the bunary representation of some file) in memory and you want to flush it to the disk. If that's the situation, I think I can help. I recently wrote a similar class. Here's the SaveAs method: _bytes is a byte[] array - a private class field.

    public void SaveAs(string filePath)
    {
    	using(FileStream stream = System.IO.File.OpenWrite(filePath))
    	{
    		stream.Write(_bytes, 0, _bytes.Length);
    	}
    }
    
    C# help tutorial

  • Importing Macros from C header files?
    I iliyang

    I hope this question don't win "The Most Stupid Question Of The Day" prize, but I was just wondering if there is an easy way to import the macros from some C header files (like CommCtrl.h) in C#. Cause they're very handy and the WinForms controls don't provide all of the functionality of the Windows Shell controlls.

    C# csharp question winforms linux

  • what is the difference between Property and Public Field?
    I iliyang

    Yes, yes! That's very important! Never expose a field publically unless it is a readonly or const. But you even can do it for them too. The only case that I use public fields in, is when deriving from EventArgs. I put some data as public readonly fields to reduce the code and to speed up the handling a little bit. And if you look up the FCL reference, there's almost no public fields exposed, unless constants such as EventArgs.Empty, String.Empty and so on.

    C# question csharp help

  • how merge 2 PNG images in one
    I iliyang
    1. use the DrawImage method of the Graphics class 4) you don't need to do anything else special. If the image that you'll draw over the first one is transperant, GDI+ will draw it correctly with alpha blending. Don't worry, just try it. I have and it works just fine ;)
    C# question performance help

  • how merge 2 PNG images in one
    I iliyang

    Well, here's what you can do: 1) create a new Image object (with the appropriate size) 2) get a Graphics object for it (Graphics.FromImage static method) 3) draw the first image on the new image (using the Graphics object) 4) draw the secons image on the new image 5) now you have an Image object that meets the requirements Or, if you don't need one of the images, draw the other one over it. Cheers ;)

    C# question performance help

  • what is the difference between Property and Public Field?
    I iliyang

    Well, it is the one magical thing that grabbed me a few years ago when I was reading a thin book about the C# language ;) The public field is just a variable that you can read and write without any control. I mean that you can set the field any value that is possible for the type of the field. And that's pretty much it. While the property is a more complex thing - it appears to be a public variable but it's a totally different thing. A property is a set of one or two functions in fact (accessor and/or modificator). For example, assume that we have the "public string Name" property. When the compiler generates the IL code, it generates also one or both of the following functions: public string get_Name() { the_statements_in_the_get_function; } public void set_Name(string value) { the_statements_in_the_set_function; } And you can do anything inside. Getting the value of a property calls the get_Name function, and setting a value to the property calls the set_Name function. That's pretty powerful, 'cause you can do many more things than return/set the actual variable beneath (if there is one) - you can raise events, force redraw etc. And of course, we should thank Delphi for this nice language feature ;) Cheers!

    C# question csharp help

  • ListView - some kind of a scroll event?
    I iliyang

    I'm working on a custom drawn ListView and when scrolled horizontally it does not redraw itself. I couldn't find a scroll event in the FCL reference and in the Windows Shell controls reference either. How could I force redrawing when the control is scrolled horizontally?

    C# linux question

  • GDI+ drawing strings causes messed gaps between letters - how to fix?
    I iliyang

    Well, turns out that it is a global issue and there's no way (at least that I know) that can fix this. Thе string that I drew was something like "bla bla the_messed_part" (1) and the string in the listview was "the_messed_part" (2). And when I tried to draw the string (2) or let the listview draw the string (1) both work the same way. So I guess the solution is to choose a different font like Tahoma, for example, which looks like MS Sans Serif. Of course, this is not a very good solution, 'cause this way I'm fixing the font and if the user has a totally different system font set, it'll be pretty ugly...

    C# graphics winforms linux help tutorial

  • GDI+ drawing strings causes messed gaps between letters - how to fix?
    I iliyang

    I just cant' get how to draw strings with "proper" letter spacing, especially when they're bold. Some letters in specific combinations when being drawn next to each other appear slured (without even a pixel gap). The font I'm using is the default MS Sans Serif 8,25pt Here's a link to a sample screenshot: >> link The left one is drawn using the Graphics.DrawString method and the right one is a screenshot from a ListView. Why is that difference? How to achieve this?

    C# graphics winforms linux help tutorial

  • Passing an int array by refеrence to a shell function - how?
    I iliyang

    Well, this time works but the values returned are messed. But, you know, this does work fine: _columnOrder = new int[this.Columns.Count]; int size = 0; IntPtr pHeader = SendMessage(this.Handle, (int) Win32.Consts.LVM_GETHEADER, 0, ref size); SendMessage(pHeader, (int) Win32.Consts.HDM_GETORDERARRAY, _columnOrder.Length, ref _columnOrder[0]); See the ref _columnOrder[0] in the second SendMessage call ;)

    C# com linux data-structures help tutorial

  • Passing an int array by refеrence to a shell function - how?
    I iliyang

    Nope, Marshal.Copy throws a NullReference exception when passing a null (0) IntPtr object. So for now, the "mystical" solution works the best :rolleyes:

    C# com linux data-structures help tutorial

  • Passing an int array by refеrence to a shell function - how?
    I iliyang

    Yes, I know that I'm passing the first element of the array, but I just tried and it worked fine :) The second method (with the IntPtr) I found ealier but I didn't know how to obtain an IntPtr object. I suppose with the IntPtr is better too. But how should I get an IntPtr object to copy the array into?

    C# com linux data-structures help tutorial

  • Passing an int array by refеrence to a shell function - how?
    I iliyang

    OK, 10x a lot! It worked finde when I called the function like this: int[] MyArrayOfInts = ... fixed(int* p_MyArrayOfInts = MyArrayOfInts) { ThatFunction(*p_MyArrayOfInts); // not: ThatFunction(p_MyArrayOfInts); }

    C# com linux data-structures help tutorial

  • Passing an int array by refеrence to a shell function - how?
    I iliyang

    OK, but the function prototype is: protected static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, ref int lParam) that is, I have to pass an integer, not an interger pointer...

    C# com linux data-structures help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups