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
A

astibich2

@astibich2
About
Posts
25
Topics
23
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Drag and drop a file onto a WPF application
    A astibich2

    Seems like this should be easy, but I can't get the 'Drop' event to fire on my WPF application main window. Here's a my demo application: When I drag and drop a file from the desktop onto the application window, I get the 'no entry' cursor during the drag, and 'Window_Drop' is not called after I drop. In fact I can't seem to get any event to fire during the file drag operation: 'DragEnter', 'DragOver', 'MouseMove', etc. What am I doing wrong? Aaron

    The Lounge csharp wpf question

  • Adorners and ScrollViewer don't get along
    A astibich2

    You're a genius!! I rewrote the GetAdornerLayer function to be this: public AdornerLayer GetAdornerLayer(Visual visual) { if (visual == null) { throw new ArgumentNullException("visual"); } for (Visual visual2 = VisualTreeHelper.GetParent(visual) as Visual; visual2 != null; visual2 = VisualTreeHelper.GetParent(visual2) as Visual) { if (visual2 is AdornerDecorator) { return ((AdornerDecorator)visual2).AdornerLayer; } //if (visual2 is ScrollContentPresenter) //{ //return ((ScrollContentPresenter)visual2).AdornerLayer; //} } return null; } Works like a charm!! Thanks for your help. Aaron

    WPF wpf csharp css wcf com

  • Adorners and ScrollViewer don't get along
    A astibich2

    Sorry if I'm not understanding. There is room outside the ScrollViewer for the adorner to draw on. Also, I don't have this problem with any other container type. If I host the textbox inside a Canvas or Grid, the adorner is not clipped and draws outside the container.

    WPF wpf csharp css wcf com

  • Adorners and ScrollViewer don't get along
    A astibich2

    I am using Adorners to show input errors on my textbox controls, and those controls are hosted within a ScrollViewer. For some reason, my adorner UI is clipped when it tries to draw outside the ScrollViewer. I'm not the first to have this problem http://social.msdn.microsoft.com/forums/en-US/wpf/thread/e060205e-5bfc-4f21-bf80-dfa55c44eb8a However, the posted solution does not work for me... Has anyone else run into this problem? Here's the XAML from my example project: <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ScrollViewer}"> <Grid x:Name="Grid" Background="{TemplateBinding Background}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Rectangle x:Name="Corner" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Column="1" Grid.Row="1"/> <AdornerDecorator Grid.Column="0" Grid.Row="0"> <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False"/> </AdornerDecorator> <ScrollBar x:Name="PART_VerticalScrollBar" Cursor="Arrow" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Grid.Column="1" Grid.Row="0" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="VerticalScrollBar"/> <ScrollBar x:Name="PART_HorizontalScrollBar" Cursor="Arrow" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{Binding Path=HorizontalOffset, Mode=OneWay, Re</x-turndown>

    WPF wpf csharp css wcf com

  • Change WPF TextBox border when it has focus
    A astibich2

    I am trying to change the border color of a WPF TextBox when it has focus. I'm doing this in code using the focus events: private void TextBox_GotFocus(object sender, RoutedEventArgs e) { _text.BorderBrush = Brushes.Red; } private void TextBox_LostFocus(object sender, RoutedEventArgs e) { _text.BorderBrush = Brushes.Blue; } This does not work. My googling seemed to indicate that the TextBox has built in focus behavior that could be overriding my behavior. The proposed solution was to null the "TextBox.FocusVisualStyle' property. This also did not work. Any ideas out there? Aaron

    WPF csharp wpf question

  • Efficient WPF drawing code
    A astibich2

    I am writing custom drawing code by overriding the OnRender function of a Canvas window. protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); // bunch of drawing code } The window that I'm drawing stretches very far in the vertical direction, so I contain it in a ScrollViewer. When data changes in the system, I want to redraw just the small portion of the window that represents that data, not the entire window. However, I can't seem to figure out how to invalidate a region of the window. I am currently invalidating, and redrawing the entire window. Help! Thanks, Aaron

    WPF csharp wpf graphics help tutorial

  • WPF ListView scrollable height
    A astibich2

    I am using the WPF ListView, with an embedded GridView, to display a table of data. When the scroll bar is present, I would like to slightly increase the scrollable height of the list, making a little more visible white space at the end of the list. Note, I do NOT want to accomplish this by adding additional empty rows to the list. Any ideas on how to accomplish this? Thanks, Aaron Stibich

    WPF csharp wpf hardware tutorial question

  • Drawing a box around an arbitrary HTML block
    A astibich2

    I am writing a winform application that allows the user to define a range in a HTML document by selecting two anchor points: beginning and end. I'd like to graphically display the selected range by programattically inserting HTML into the in-memory version of the HTML, which should then render in my WebBrowser control. Ideally, I'd like to draw a box around the selected range, maybe with a nice colored background. Unfortunately, the beginning and ending anchor points may not reside in the same HTML block, and I'm not sure how to write the HTML to make a box span HTML blocks like that. Clear as mud? Any thoughts or ideas would be appreciated. Aaron

    Web Development html graphics performance tutorial question

  • Customizing the Winfom WebBrowser control
    A astibich2

    I am using the Winform's WebBrowser control to display HTML documents in my application. Now I need to draw a line above a certain HTML element in the document, and I'm hitting a road blocks. First, I tried to simply paint a line above the element, but quickly found that the WebBrowser doesn't support the paint event. Next, I tried to just position a thin, "line-like" control above the HTML element. I know the position of the element within the document, but to position the control properly, I'd need the WebBrowser scroll position. I'm reading that you can't read the scroll position, or receive scroll events from the WebBrowser control. Anyone have a plan C? Thanks, Aaron

    .NET (Core and Framework) html question

  • Appending the ToolboxItem.DependentAssemblies property
    A astibich2

    I am writing a Visual Studio 2008 Tool Window plugin that exposes a custom toolbox. I create controls on Forms using the 'ToolboxItem' class. I would like to append to the ToolboxItem dependencies, such that my assembly will be auto-inserted as a reference after the control creation. Here's an example of what I'm trying to do: ToolboxItem tbi = new ToolboxItem(typeof(CheckBox)); AssemblyName[] depends = tbi.DependentAssemblies; List listDepends = new List(); listDepends.AddRange(depends); listDepends.Add(new AssemblyName("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e7d025b3483b4afc")); tbi.DependentAssemblies = listDepends.ToArray(); The control gets created fine, but 'MyAssembly' is not added to the project references. 'MyAssembly' is installed in the GAC - I've double checked that the full path is correct. Thanks, Aaron

    .NET (Core and Framework) csharp dotnet visual-studio tutorial announcement

  • Controlling the ToolboxItem control type during a drag operation
    A astibich2

    I am currently writing a custom toolbox window for Visual Studio 2008, using the SDK. When the user drags from the list, I start a drag drop operation using ToolboxItem as the drag data. ToolboxItem tbi = new ToolboxItem(myControlType); IToolboxService serviceToolBox = (IToolboxService)GetService( typeof(IToolboxService)); object tbiSerialized = serviceToolBox.SerializeToolboxItem(tbi); this.DoDragDrop(tbiSerialized, DragDropEffects.Copy); When they drop the ToolBoxItem, I use the 'ToolboxItem.ComponentsCreated' event to write some extra setup code on the control void dropToolBoxItem_ComponentsCreated(object sender, ToolboxComponentsCreatedEventArgs e) { // write custom control config code here } However, I'm finding that I sometimes want control over the ToolboxItem control type, based on UI conditions during the drag. For example, I may want to create a different control on the designer if the user holds down the shift key. Sometimes I want to block the drop completely. Unfortunately, I don't see a way to change the ToolboxItem after I start the drag. It seems like the 'ToolboxItem.ComponentsCreating' event was meant for this kind of intervention, but I can't change the control type when the 'ToolboxItem.ComponentType' property is read only. I've tried a few hacks (like deleting the control after drop and re-creating the new control type), but none of it has worked out very well. Anyone have any ideas? Thanks, Aaron

    .NET (Core and Framework) csharp visual-studio design tutorial question

  • Hooking into Visual Studio 2008 Designer drag events
    A astibich2

    Is this the right spot to ask questions about Visual Studio 2008 extensibility? I am writing a Visual Studio 2008 Integration Package, using the SDK, and I would like to attach behavior code to the designer drag events (DragEnter, DragOver and DragDrop). I have a custom tool window with a list of available commands to our electronic measurement device. I want the ability to drag a command from that list onto the surface of a winform designer. Dropping the command item should automatically create the default control type and write the code that hooks it to the equipment command. Alternatively, I'd like it if the user could drag a command onto an existing control and have the connection code written. I think I see how to automate the creation of controls and code in a Form designer, but I can't figure out how to hook that code to the designer drop event. Thanks, Aaron

    .NET (Core and Framework) csharp visual-studio tutorial question

  • How do I draw the image of a 'System.Windows.Form.Control' instance onto another Form
    A astibich2

    I'm writing an editor Form that operates on any instance of a 'Control' class. I'd like to show an image of the active control context in the upper left of my Form - just so the user gets a visual of what control they are working on. Is there a way to get a Control to draw onto a Form that is not its parent? I've been play around with Control.DrawToBitmap, but I can't seem to make it work :( Thanks, Aaron

    C# question

  • Destroying controls created by CWinFormControl
    A astibich2

    I'm using CWinFormControl to create instances of .Net UserControls. CWinFormsControl m_control; m_control.CreateManagedControl( WS_CHILD | WS_VISIBLE, rect, this, IDC_HOSTCONTROL ); This works fine. The problem occurs when I try to destroy the control. I need a deterministic call to the 'MyControl' finalizer, so I wrote the following: m_control.DestroyWindow(); System::GC::Collect(); This code does not cause the Finalize\Dispose code to be called on 'MyControl'. In fact, 'MyControl' sticks around in memory until the MFC app closes. What am I doing wrong here? Thanks, Aaron

    C / C++ / MFC csharp c++ performance help question

  • Destroying controls created by CWinFormControl
    A astibich2

    I'm using CWinFormControl to create instances of .Net UserControls. CWinFormsControl m_control; m_control.CreateManagedControl( WS_CHILD | WS_VISIBLE, rect, this, IDC_HOSTCONTROL ); This works fine. The problem occurs when I try to destroy the control. I need a deterministic call to the 'MyControl' finalizer, so I wrote the following: m_control.DestroyWindow(); System::GC::Collect(); This code does not cause the Finalize\Dispose code to be called on 'MyControl'. In fact, 'MyControl' sticks around in memory until the MFC app closes. What am I doing wrong here? Thanks, Aaron

    Managed C++/CLI csharp c++ performance help question

  • Generic Control property changed event?
    A astibich2

    Is there a way to be notified, through an event or callback, when any control property changes? For example, I would like to have my code notified if any public property changes on my Form's System.Windows.Form.Text control. Thanks, Aaron Stibich

    .NET (Core and Framework) tutorial question

  • Exception initializing SplitContainerDesigner
    A astibich2

    I am playing with the custom form designer example application posted here: http://support.microsoft.com/default.aspx?scid=kb;en-us;813808 I extended the for tool box to include a 'SplitContainer' control, but the container fails to create the control. The failure occurs when the container calls SplitContainerDesigner.Initialize(component). The exception is {"Object reference not set to an instance of an object."}, which doesn't make sense since both the designer and component seem to be initialized properly. I don't seem to be the only one having this problem. I saw a similar question posted here: http://www.developmentnow.com/g/32\_2005\_9\_0\_0\_602525/VS2005b2-SplitContainerDesigner--designer-Initialize-throw-an-exception.htm Thanks Aaron Stibich

    .NET (Core and Framework) question com docker help tutorial

  • TreeView customization
    A astibich2

    Is there a way to change the default node class type used by a TreeView control? I would like the TreeView to operate normally, but instead of creating TreeViewNode objects, to create MyTreeViewNode objects. I would like the node to expose an additional attribute. class MyTreeViewNode: TreeViewNode { public string ExtendedProperty { get { } } }

    C# question

  • Adding a drag handle to my custom UserControl
    A astibich2

    You know how some winform controls have a drag handle in the upper left corner, inside the winform designer (eg. the groupbox)? Is there an easy way to make my custom UserControl have the same drag handle button? Thanks, Aaron

    C# question

  • How do I create a generic .Net event handler
    A astibich2

    I am attempting to write code that sinks an event with only an object reference and the event name - no type information. I write a generic event handler function: public void ComponentEventHandler(object o, EventArgs e) { // handle generic event } Then I wrote some code that attaches any event to this event handler function protected void SinkControlEvent(Control ctrl, string eventName) { EventDescriptor event = TypeDescriptor.GetEvents(ctrl)[eventName]; Delegate del = Delegate.CreateDelegate(typeof(System.EventHandler), this, "ComponentEventHandler"); event .AddEventHandler(ctrl, del); } This works fine when the event I'm sinking has the standard function signature. However, I get an exception when the event has a derived EventArgs parameter. For example, trying to sink the following event would cause a type mismatch exception: public event void ValueChanged(object sender, ValueEventArgs e); The exception is "Invalid event handler for ValueChanged event". Of course 'ValueEventArgs' inherits from EventArgs, so I don't understand why this isn't a valid handler. Some things to note: 1. You can, in code, assign an untyped event handler to a typed event. Somehow the compiler figures it out. 2. I tried changing my code such that I attach an untyped function to a typed delegate, but that also threw an exception. Delegate del = Delegate.CreateDelegate(event.EventType, this, "ComponentEventHandler"); Thanks, Aaron Stibich

    C# csharp tutorial question learning
  • Login

  • Don't have an account? Register

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