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
K

KeesVer

@KeesVer
About
Posts
23
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to retrieve a system error message
    K KeesVer

    Hello, I want to retrieve the text associated with a system error message from the windows resources. Example: Environment.GetResourceString('ArgumentOutOfRange_Index')); This code wont compile because GetResourceString is not a public method. So how can I get the error message for 'ArgumentOutOfRange_Index'? Thanks in advance! Kees Vermeulen

    .NET (Core and Framework) tutorial question help workspace

  • What is the .Net equivalent of GetSystemMetrics(SM_CXVSCROLL)?
    K KeesVer

    Thanks!

    .NET (Core and Framework) question csharp

  • Line with different width have different lengths?
    K KeesVer

    Thanks Luc, Setting EndCap and StartCap to LineCap.Square solved it. Kees

    .NET (Core and Framework) graphics question

  • Line with different width have different lengths?
    K KeesVer

    Given the code below, the first line is drawn 1 pixel longer than the second line (any line where width > 1 is drawn 1 pixel short). Any idea what might be causing this or is this normal behavior? Pen p = new Pen(Color.Black, 1); e.Graphics.DrawLine(p, 10, 10, 10, 100); p = new Pen(Color.Black, 2); e.Graphics.DrawLine(p, 14, 10, 14, 100); p.s. The same thing happens when drawing horizontal lines. Kees

    .NET (Core and Framework) graphics question

  • How to draw miter joined lines?
    K KeesVer

    Hello, I want to draw two lines which are mitered at the corners (see: http://www.kever.com/images/corners.jpg). As you can see both lines have different properties (like color) and can even be of different widths. Therefore I draw each line separately (using Graphics.DrawLine and not DrawLines). My idea is to create a pen with a custom end cap so that the endpoints have a 45 degrees angle. Anybody knows how to setup a CustomLineCap to achieve this? Kees

    .NET (Core and Framework) com graphics tutorial question workspace

  • Sorted list
    K KeesVer

    Thanks, I do not always have a key AND a value. Sometimes the Key IS the Value and therefore using a Dictionary or SortedList is cumbersome. However, from your answers I conclude that under .Net this is the way to go. Kees

    .NET (Core and Framework) question csharp

  • Sorted list
    K KeesVer

    Thanks for your answer. I have many occasions in which I use sorted lists! For example to prevent insertion of duplicate items and for fast retrieval of existing items. For example, in my situation I have a function parser which can handle various predefined functions. These functions are simply strings and I want to test if a certain string is a predefined function. Looking up a string in a sorted list would be much faster than doing so from an unsorted list. Kees

    .NET (Core and Framework) question csharp

  • Sorted list
    K KeesVer

    Pete, I want the sort order to be maintained so that new items are inserted at the right position in the list without calling List<>.Sort every time. Kees

    .NET (Core and Framework) question csharp

  • Sorted list
    K KeesVer

    Hello, How can I create a sorted list in .Net? Something like: SortedList L = new SortedList(); L.Add("B"); L.Add("A"); Now L[0] should contain "A". I found class SortedList but this requires two types which seems an overkill to me. Thanks in advance, Kees Vermeulen

    .NET (Core and Framework) question csharp

  • Calling InitializeFromBitmap fails with exception "The method or operation is not implemented"
    K KeesVer

    Thanks for your reply. Meanwhile I've come a lot further. The problem was that methods SetData and GetData where not implemented. Therefore I created a new DataObject class which re-implements these methods. This is the code I have so far which is working but needs some adjustments here and there. Also I'm not sure whether all allocated objects are released correctly. Regards, Kees public partial class CustomControl1 : Control { DragDropHelper Helper; public CustomControl1() { InitializeComponent(); this.AllowDrop = true; } protected override void OnPaint(PaintEventArgs pe) { Brush B = new SolidBrush(Color.White); pe.Graphics.FillRectangle(B, pe.ClipRectangle); } protected override void OnMouseDown(MouseEventArgs e) { DataFormats.Format ganttbarFormat = DataFormats.GetFormat("Ganttbar"); object ganttbar = new object(); DataObject dragObject = new DataObjectEx(ganttbarFormat.Name, ganttbar); DoDragDrop(dragObject, DragDropEffects.All); } private void UpdateDragImage(System.Runtime.InteropServices.ComTypes.IDataObject dragObject) { if (Helper == null) { Helper = new DragDropHelper(); } IDragSourceHelper Drag = (IDragSourceHelper)Helper; SHDRAGIMAGE tt = new SHDRAGIMAGE(); Bitmap img = new Bitmap(@"C:\Temp\DragImage.bmp"); tt.ptOffset.x = 0; tt.ptOffset.y = 0; tt.sizeDragImage.x = img.Width; tt.sizeDragImage.y = img.Height; tt.hbmpDragImage = img.GetHbitmap(); tt.crColorKey = 0; Drag.InitializeFromBitmap(ref tt, dragObject); } protected override void OnDragOver(DragEventArgs drgevent) { IDropTargetHelper H = (IDropTargetHelper)Helper; POINT p = new POINT(); p.x = drgevent.X; p.y = drgevent.Y; H.DragOver(ref p, DragDropEffects.Copy); drgevent.Effect = DragDropEffects.Copy; } protected override void OnDragDrop(DragEventArgs drgevent) { System.Runtime.InteropServices.ComTypes.IDataObject dragObject = (System.Runtime.InteropServices.ComTypes.IDataObject)drgevent.Data; IDropTargetHelper H = (IDropTargetHelper)Helper; POINT p = new POINT(); p.x = drgevent.X; p.y = drgevent.Y; H.Drop(dragObject, ref p, DragDropEffects.Copy); base.OnDragDrop(drgevent); } protected override void OnDragEnter(DragEventArgs drgevent)

    C# graphics question

  • Calling InitializeFromBitmap fails with exception "The method or operation is not implemented"
    K KeesVer

    Hello, I have the following code in one of my projects: DragDropHelper Helper = new DragDropHelper(); // See below! IDragSourceHelper Drag = (IDragSourceHelper)Helper; SHDRAGIMAGE tt = new SHDRAGIMAGE(); Bitmap img = new Bitmap(@"C:\Temp\DragImage.bmp"); tt.ptOffset.x = 0; tt.ptOffset.y = 0; tt.sizeDragImage.x = img.Width; tt.sizeDragImage.y = img.Height; tt.hbmpDragImage = img.GetHbitmap(); tt.crColorKey = 0; Drag.InitializeFromBitmap(ref tt, dragObject); Calling InitializeFromBitmap fails with the above mentioned message. Can any one tell me why? In addition, this code is in my project as well: [StructLayout(LayoutKind.Sequential)] public struct POINT { public int x; public int y; } [StructLayout(LayoutKind.Sequential)] public struct SHDRAGIMAGE { public POINT sizeDragImage; public POINT ptOffset; public IntPtr hbmpDragImage; public uint crColorKey; } [ComImport, Guid("DE5BF786-477A-11d2-839D-00C04FD918D0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] interface IDragSourceHelper { void InitializeFromBitmap( ref SHDRAGIMAGE pshdi, [MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject); void InitializeFromWindow( IntPtr hwnd, ref POINT point, [MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject); } [ComImport, Guid("4657278B-411B-11d2-839A-00C04FD918D0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] interface IDropTargetHelper { void DragEnter(IntPtr hwnd, [MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, ref POINT point, DragDropEffects dwEffect); void DragLeave(); void DragOver(ref POINT point, DragDropEffects dwEffect); void Drop([MarshalAs(UnmanagedType.Interface)] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, ref POINT point, DragDropEffects dwEffect); void Show([MarshalAs(UnmanagedType.Bool)] bool fShow); } [ComImport, Guid("4657278A-411B-11d2-839A-00C04FD918D0")] class DragDropHelper { }

    C# graphics question

  • Getting field type from database
    K KeesVer

    Thanks for your support.

    .NET (Core and Framework) question database com graphics help

  • Getting field type from database
    K KeesVer

    How can I detect whether a certain field retrieved from the database contains an image or other type of blob? I have a MSAccess table with an OLE-Object field holding a bitmap. This field is added to the DataTable as an System.Byte[] type. How do I know whether this field actually holds an bitmap? Thanks for any help you can give. Regards, Kees Vermeulen

    .NET (Core and Framework) question database com graphics help

  • Changing the datatype of strings
    K KeesVer

    You can convert your data on the fly using a cast: select cast(columnname as int) from ...

    C# csharp tutorial question

  • CreateChildView vs GetChildRows
    K KeesVer

    Reflector? I never used it, where can I find this tool? Kees

    C# visual-studio data-structures help question

  • CreateChildView vs GetChildRows
    K KeesVer

    I want to display a complete view at once: Company 1 - User 1 - User 2 Company 2 - User 3 - User 4 etc. Therefore I run through all parent records, fetch the children and store them both in a flat list. This is different from having two separate grids, one showing the parent records and one showing the children of the selected parent record. Loading the data into the tables is no problem (calling Fill() only takes about 400 ms). Only building the view takes time when using CreateChildView instead of GetChildRows. Kees

    C# visual-studio data-structures help question

  • CreateChildView vs GetChildRows
    K KeesVer

    Hello, I want to load an hierarchical view using two tables: Companies and users. There are about 25000 records in both tables. If I use CreateChildView to retrieve the child rows for everycompany record, building the complete tree takes about 3 minutes (!!): foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.CreateChildView("Companies_Users"); } However, when I use GetChildRows the same code only takes 80 ms: foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.Row.GetChildRows("Companies_Users"); } Can anyone explain why there is such a big difference? Thanks for any help you can give me. Regards, Kees Vermeulen

    C# visual-studio data-structures help question

  • Two BindingContext's don't work
    K KeesVer

    I'm having trouble using two seperate BindingContext's on the same form. The form contains two group boxes, each containing a TextBox. The TextBoxes are bound to the same field of the same BindingSource. Each group box has it's own BindingContext: void BindControls() { groupBox1.BindingContext = new BindingContext(); groupBox2.BindingContext = new BindingContext(); textBox1.DataBindings.Add("Text", projectsBindingSource, "prDescription"); textBox2.DataBindings.Add("Text", projectsBindingSource, "prDescription"); } projectsBindingSource is of type BindingSource! Now I would expect that I could scroll the context in one group box independantly of the other. However, when I execute the following code: BindingManagerBase projectsBinding; projectsBinding = groupBox1.BindingContext[projectsBindingSource]; projectsBinding.Position++; Both groupBox1 and groupBox2 scroll to the next record. Ant idea's Regards, Kees Vermeulen

    Database

  • How to seperate Date and Time in SQL
    K KeesVer

    select cast(cast(getdate() as int) as datetime) as DateVal, getdate()-cast(getdate() as int) as TimeVal

    Database database tutorial

  • Does BindingSource.Find() use an index?
    K KeesVer

    Thanks for your reply, your information is very clear.

    Database database algorithms performance tutorial question
  • Login

  • Don't have an account? Register

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