winforms

C# WinForms problem with draw image

Hi I have this class: class OriginalImage: Form { private Image image; private PictureBox pb; public OriginalImage() { pb = new PictureBox {SizeMode = PictureBoxSizeMode.CenterImage}; pb.SizeMode = PictureBoxSizeMode.StretchImage; Controls.Add(pb); image = Image.FromFile(@"Image/origina...

Current Line For Visual Studio Macros

How can I read text of a current line (where cursor is situated) from Macros? I'm going to use such a function: Public Sub AddTextToChangeLogFile() Dim textOnACurrentLine As ??? textOnACurrentLine = ??? If textOnACurrentLine.Text <> String.Empty Then Dim sw As New StreamWriter("C:\###\Changes.txt", True) s...

How to expose a control collection to a property grid at design time

I have a custom control that with a property that is a collection of custom object. This custom object hava a reference to some component/controls. When at design time I tray to add an item to the collection and select the object, VS tells me that the control is not serializable. This is the code (simplified version - but not to much)...

WinForms TabControl: How to avoid tab-rendering on DrawMode=OwnerDrawFixed?

I extended the (WindowsForms) built-in TabControl so that users can close tabs right on the tab itself ("x" image on the right like in Webbrowsers). The inherited control renders the text and images. Also, it uses visual styles on hover etc. All works very well, but I have one problem I can't solve. When the tabs are rendered, I cannot ...

Accessing additional context data in EditValue of UITypeEditor

I'm tweaking a WinForms application. This application has a Form that contains a PropertyGrid. An object is assigned to the SelectedObject property so that the property grid displays the properties for the object. The type of the object assigned has a property that carries an EditorAttribute specifying a UITypeEditor. This implementa...

Multiplayer game

Using either XNA OR just the usual c# win forms application, which would be the best way to create the feature that enables text messages to be sent from me to my friend over the internet? I don't know if this matters or not, but I now have 3 Mobile Broadband internet... so it's like... Wireless internet, does that matter? ...

SendMessage vs. WndProc

I'm trying to extend TextBox control to add watermarking functionality. The example I've found on CodeProject is using imported SendMessage function. [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, uint wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam...

how to display formatted text but have the actual text

hello I have my own textbox which inherits System.Windows.Forms.TextBox I am trying to display texts like 5000000 formatted ==> 5,000,000 but the problem is that Control.Text should return 5000000 but it should display 5,000,000. I know it is WTF, but i really need it and i couldn't Google a lot because my native language is not Engl...

What's the best way to "dim" background of winform while displaying a dialog?

I'd like to implement a feature in my application where show a dialog to the user, and the main form (similar to how jQuery looks). My only idea is to take a screenshot of the form, place it as the background of a panel (with opacity to my liking) then pushing the panel over everything on the form. I have to believe there is a better w...

How can I attach a Silverlight OOB to a Winforms panel?

Summary: I want the prettiness of Silverlight/WPF in part of my current Winforms application. The application can only have access to the full .NET Framework 2.0, no more and no less. The only possibility I can think of is a Silverlight OOB application that utilizes Com+ Automation but I can't figure out how to attach the Silverlight a...

Modify scroll speed, treeview drag&drop in C#

i have a treview control with drag&drop functionality that response to draw the node outside the visible limits scrolling in the apropiate direction. The problem is that it scroll at light speed. I need a way to modify this speed. ...

Expandable Property Grid in Win Forms ( C++/CLI)

Hi, I am a bit new at this .NET stuff so my aplogies in advance. I have written a class that I wish to behave as an expandable property in the property grid. I have written a Type Converter....etc. The type converter stuff is from morganskinner.com and I adapted it to C++/CLI. Everything compiles correctly except (i) the class does not ...

Resize a ListView depending on how many items?

Hello. How can I resize the height of a ListView depending on how many items are in that ListView? I'm trying to get the text of an item which is clicked, however whenever the user clicks on a space which has no item, there's an error. The exact error is: InvalidArgument=Value of '0' is not valid for 'index'. Parameter name: inde...

Redraw and flicker issues

I have an Outlook style app. So basically I have a sidebar on the left and on the right I have a panel control (pnlMainBody) that hosts content. The content is typically a user control that I add to the panel when user clicks appropriate button in the side bar. The way I add the user control to the panel is as follows: // _pnlEmail...

scrolling two panels at same time c# winForms

yea so I have 2 panels with the same width and the same width of data in them. the top panel has autoscroll enabled. I would like to be able to scroll both panels, with the top panel scrollbar. which means that the bottom panel doesn't have a scroll bar. How would I do that? EDIT: I tried panel2.AutoScrollPosition = panel1.AutoScrollP...

How to represent "options" for my plugin architecture (C# .NET WinForms)

Okay basically here's where I'm at. I have a list of PropertyDescriptor objects. These describe the custom "Options" fields on my Plugins, aka: public class MyPlugin : PluginAbstract, IPlugin { [PluginOption("This controls the color of blah blah blah")] [DefaultValue(Color.Red)] public Color TheColor { get; set; } [PluginOption("...

Adding a border (Fixed3D) to an existing borderless application

Hi there, I have an .NET application that always starts itself with its border style to 'None', as it is supposed to be an full-screen application with a fixed resolution. However, i would like to add the window border (Fixed3D) to this window when the application starts so that I am able to move it around my desktop. My first idea wa...

Cannot enter dot in a textbox

In my grid view i have link type column. as we cannot edit cell of such type i am displaying a text box if user select cell for editing. but my text box is unable read dot character. I checked "key pressed" and "text changed" events but events are not triggered for dot as a input. EDIT: I can enter any character or symbol except dot.. ;...

execute some code at a certain time daily

Hi, How can I execute some code, once a day. e.g. call MyMethod() at 3pm every day. (provided the app is running of course)... Im trying to do this in c# winforms. ...

ClickOnce Deployment online questions

Hi all, Bit of a strange question, but how do ClickOnce deployments work from a web site? I seem to be having some problems with this. Basically, the setup file will download when you click the "install" button, but then some files are missing. Do you need to be on a Microsoft server to run ClickOnce deployments? I usually do deploymen...