Search Results

Search found 2806 results on 113 pages for 'winforms'.

Page 68/113 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • Background Worker Check For When It's Midnight?

    - by Soo
    I want to create a background worker for a WinForm that triggers code whenever midnight rolls by. I have an idea of how to do it, but I'm pretty sure it's not the best way to do it. while(1==1) { //if Datetime.Now == midnight, execute code //sleep(1second) }

    Read the article

  • Is MDI Form focused?

    - by Vercas
    I've had so much luck developing my application... until now. My application's main form is a MDI parent, and I didn't think of adding any MDI children in my tests until tonight. To my surprise, the MDI parent seems to never "get focus" now. The Focus event and the OnFocus method are never called! I mean... it appears focused but none of the in-code focusing events/methods work. Instead a MDI child reports the focus. How do I fix this?

    Read the article

  • winUserControl in VS2010 - properties are not visible in designer

    - by mj82
    I have a problem with (I suppose) my Visual Studio 2010 Express environment: when I design my own UserControl, in Properties grid I can't see public properties of that control. They are however visible in the project, that reference this control. As it's Express Edition, I create new empty project, then add new UserControl to it. Then, for a test, I put following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Project1 { public partial class UserControl1 : UserControl { private int myNumber; [Browsable(true)] public int MyNumber { get { return myNumber; } set { myNumber = value; } } public UserControl1() { InitializeComponent(); } } } In VS 2008, as I remember, that should be enogh to show MyNumber property in Properties grid, even without [Browsable(true)] attribute. In VS 2010 however, when I double click UserControl1.cs in Solution Explorer and look in Properties, I don't see MyNumber. When I reference and use this control in another project, there is an access to it's properties. I've tried to competly reinstall VS 2010 environment, including SP1, but with no success. Do you have any idea what can be wrong? By the way: none of these attributes are working, either: [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Bindable(true)] Best regards, Marcin

    Read the article

  • Custom Control Overriding Command Button

    - by pm_2
    I am trying to create a custom command button that defaults width and height to specific settings. I have the following code: public partial class myCommandButton : Button { public magCommandButton() { InitializeComponent(); } [DefaultValue(840)] public override int Width { get { return base.Width; } set { base.Width = value; } } [DefaultValue(340)] public override int Height { get { return base.Height; } set { base.Height = value; } } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } } However, it won't compile because it tells me that I can not override Width or Height. Can anyone tell me if I'm approaching this wrongly, or if there's a way around this?

    Read the article

  • Best free Windows Forms validator control

    - by Salar
    What is the best free Windows Forms validator control. I want to use it in a free (and maybe open-source) project. I know these: ValidationProvider Control not working in VS2010 DXValidationProvider works only for devexpress controls. Supervalidator from DevComponents meets my needs but it isn't free. here is a picture of it:

    Read the article

  • What pattern to use in this scenario?

    - by jess
    Hi, We have got many forms(windows app C#) in our application.We have similar steps in most of them - user adds a new object(in a grid),fills values and save.On,save,we validate,and save if everything ok,else show message.Now,adding of object usually means we add a new row with some default values.

    Read the article

  • SetScrollPos: scroll bar moving, but control content not updating

    - by sniperX
    [DllImport("user32.dll")] public static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw); [DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)] public static extern int GetScrollPos(int hWnd, int nBar); So those are the externs im using to move the scroll position, what im doing, is i get the current position, and add or substract an exact amount of pixels, and the scroll bar on my form moves perfectly how i want it, but the content in the control stays stationary. What is the problem here?

    Read the article

  • Updating UI objects in windows forms

    - by P a u l
    Pre .net I was using MFC, ON_UPDATE_COMMAND_UI, and the CCmdUI class to update the state of my windows UI. From the older MFC/Win32 reference: Typically, menu items and toolbar buttons have more than one state. For example, a menu item is grayed (dimmed) if it is unavailable in the present context. Menu items can also be checked or unchecked. A toolbar button can also be disabled if unavailable, or it can be checked. Who updates the state of these items as program conditions change? Logically, if a menu item generates a command that is handled by, say, a document, it makes sense to have the document update the menu item. The document probably contains the information on which the update is based. If a command has multiple user-interface objects (perhaps a menu item and a toolbar button), both are routed to the same handler function. This encapsulates your user-interface update code for all of the equivalent user-interface objects in a single place. The framework provides a convenient interface for automatically updating user-interface objects. You can choose to do the updating in some other way, but the interface provided is efficient and easy to use. What is the guidance for .net Windows Forms? I am using an Application.Idle handler in the main form but am not sure this is the best way to do this. About the time I put all my UI updates in the Idle event handler my app started to show some performance problems, and I don't have the metrics to track this down yet. Not sure if it's related.

    Read the article

  • OnPaint event during a callback when the form is below?

    - by Martín Marconcini
    Imagine the following scenario: this.SetStyle(ControlStyles.UserPaint, true); //this doesn’t change anything … void OpenSomeForm() { SomeForm sf = new SomeForm(); sf.SomeEvent += new … (SomeEventOcurred); sf.ShowDialog(); } private void SomeEventOcurred(…) { OnePanelInThisForm.Invalidate(); } private void OnePanelInThisForm_Paint(object sender, PaintEventArgs e) { DoSomeDrawing(e.Graphics); } Now, OnePanelInThisForm draws correctly when the form loads. But if SomeEventOcurred is Fired from “SomeForm”, the paint event is not fired. If I close and reopen the form it correctly repaints. If I add a button to the form that executes: OnePanelInThisForm.Invalidate(); the panel is correctly repaint. What am I missing?

    Read the article

  • Smooth Text On Glass

    - by j-t-s
    Hi All I have seen many other samples out there that draw smooth text on glass. But I can't use them. I need every single label that gets added at runtime to be smooth. I can't just "draw" text onto the screen. Is this at all possible, and are there and sources around? Thank you

    Read the article

  • How do i get the mouse position?

    - by acidzombie24
    Basically in relation to this question It seems like e.X,y and e.Location.X,Y is relative to mousedown? I seen negative values when i havent moved it left/above the parent picbox. So it seems like the values are relative to my mousedown, but i need values relative to the parent because i update the left/top every event and other datat and relative to mousedown is breaking my code.

    Read the article

  • Using combo boxes with a binding source and multiple tables

    - by Scott Chamberlain
    I have two data tables in a data set for example lets say Servers: | Server | Ip | Users: | Username | Password | ServerToConnectTo | and there is a foreign key on users that points to servers. How do I make a combo box that list all of the servers. Then how do I make the selected server in that combo box be saved in the data set in the ServerToConnect to column.

    Read the article

  • How do I refer to a windows form control by name (C# / VB)

    - by Alex
    Suppose I have a label control on a windows form called "UserName". How can I refer to that label programmatically using the label name? For example I can do: For each ctrl as Control in TabPage.Controls If ctrl.Name = "UserName" Then ' Do something End If Next This seems quite inefficient. I would like to do something like: TabPage.Controls("UserName").Text = "Something" I did some googling but couldn't find a satisfactory answer. Most suggested looping, some said .NET 2005 doesn't support direct refenece using string name, and FindControl method was asp.net only... EDIT Thanks for the response so far. Here is a bit more detail. I have a windows form with three tabpages, all of which a very similar in design and function i.e. same drop down menus, labels, react in simlar way to events etc. Rather than write code for each event per tabpage I have built a class that controls the events etc. per tabpage. For example, on each tabpage there is a Label called "RecordCounter" that simply shows the number of rows in the datagridview when it is populated by selection of a variable in a drop down menu. So what I want to be able to do is, upon selection of a variable in the drop down menu, the datagridview populates itself with data, and then I simply want to display the number of rows in a label ("RecordCounter"). This is exactly the same process on each tabpage so what I am doing is passing the tabpage to the class and then I want to be able to refer to the "RecordCounter" and then update it. In my class I set the ActivePage property to be the TabPage that the user has selected and then want to be able to do something like: ActivePage.RecordCounter.Text = GetNumberOfRows()

    Read the article

  • Mouse Wheel Scroll

    - by Rahat
    Is there anyway to capture the time interval between mouse wheel scroll stat and stop. Actually i wan to capture the interval between the scrolling start and stop when i very quickly scroll the mouse wheel. Any advice will be appreciated.

    Read the article

  • mdi child forms slow to draw when visibility changed

    - by dandan78
    My application has the following UI configuration: The main form is an MDI container. Its child forms are attached to a tabstrip. Each user has his set of child forms. Depending on the active user, only that user's child forms are displayed, together with tabs. This is achieved by going through the main form's MdiChildren and setting their Visible property to false/true depending on the active user. This has two undesired effects. One is that every child form gets redrawn in succession, which is ugly and slow. The other is that for some reason the forms go from maximized to normal, effectively undocking them from the main form. Is there any way to display just one of the child forms, such as the one the user was previously looking at, and get the others to stay in the background? The maximize/normal thing is not that big a deal because I can maximize them again manually.

    Read the article

  • How to bring a form in the top of desktop?

    - by Kovu
    hi, I will let popup a form in C#.net 2.0 and it should be so long in front of the desktop until the user clicks the close button. How to do? I tried the code from here: http://dotnet-snippets.de/dns/fenster-wirklich-in-den-vordergrund-des-desktops-bringen-SID1005.aspx But it didn't work. My system is Win7.

    Read the article

  • Running Services.msc as a different User C#

    - by Simon Mark Smith
    Hi, I have a requirement to create a simple windows forms application that allows an admin user to manage the Services on remote servers. We don't want to give the admins the usernames and passwords to the servers so these will be encrypted and stored in a database. My question is whether or not it is possible to spawn a Services.msc window when impersonating one of the users stored within the database? I have looked at the ProcessStartInfo class but because Services.msc is not an executable it does not seem to like executing this. Any ideas on a simple way of doing the actual impersonation and loading of Services.msc - say off a button click? Thanks

    Read the article

  • DataGridView: how to focus the whole row instead of a single cell?

    - by Tomas Sedovic
    I'd like to use the DataGridView control as a list with columns. Sort of like ListView in Details mode but I want to keep the DataGridView flexibility. ListView (with Details view and FullRowSelect enabled) highlights the whole line and shows the focus mark around the whole line: DataGridView (with SelectionMode = FullRowSelect) displays focus mark only around a single cell: So, does anyone know of some (ideally) easy way to make the DataGridView row selection look like the ListView one? I'm not looking for a changed behaviour of the control - I only want it to look the same. Ideally, without messing up with the methods that do the actual painting.

    Read the article

  • Winform .Net 3.5 - Get path of ApplicationFolder for Office Add-In

    - by Serexx
    Greetings - I am writing an add-in for Expression Web 3 in VS2008 The solution has a Windows Installer setup project in which the ApplicationFolder is tagged to hold some ancillary files. I need to be able to access those files during the add-in's startup, but naturally the Application object as well as the AppDomain reference paths to Expression Web not to the Add-In. There is a tickle in the back of my head that the solution involves reflection but thats as far as I can get... has anyone dealt with this or have any suggestions? Thanks!

    Read the article

  • Sliding & Fading controls on a C# form

    - by Tommy
    Hey there, I'm trying to implement a way to slide&fade controls around (more than one at the same time possibly) elegantly. So in other words, say i had a picture in the top left corner, and a texbox in the bottom right corner, i'd like to be able to have them slide. not just snap. slide, to the opposite corners and replace eachothers position. Ive been working for awhile but have not come up with anything efficient, even just some of the basic math calculations would be a great start.

    Read the article

  • Connect to MySQL via PHP script tunnel

    - by Neo
    Here's the question, I need to connect to a remote MySQL database from my C# Application, problem is the MySQL instance will block all access to all IP's apart from localhost, this can not be changed as its too much of a security issue. The question is, is it possible to connect via a tunnel instead to a php script hosted on the server, this would then act as the mysql connection. Any ideas and suggestions?

    Read the article

  • Why some pictures are are crooked aftes using my function?

    - by Miko Kronn
    struct BitmapDataAccessor { private readonly byte[] data; private readonly int[] rowStarts; public readonly int Height; public readonly int Width; public BitmapDataAccessor(byte[] data, int width, int height) { this.data = data; this.Height = height; this.Width = width; rowStarts = new int[height]; for (int y = 0; y < Height; y++) rowStarts[y] = y * width; } public byte this[int x, int y, int color] // Maybe use an enum with Red = 0, Green = 1, and Blue = 2 members? { get { return data[(rowStarts[y] + x) * 3 + color]; } set { data[(rowStarts[y] + x) * 3 + color] = value; } } public byte[] Data { get { return data; } } } public static byte[, ,] Bitmap2Byte(Bitmap obraz) { int h = obraz.Height; int w = obraz.Width; byte[, ,] wynik = new byte[w, h, 3]; BitmapData bd = obraz.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); int bytes = Math.Abs(bd.Stride) * h; byte[] rgbValues = new byte[bytes]; IntPtr ptr = bd.Scan0; System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes); BitmapDataAccessor bda = new BitmapDataAccessor(rgbValues, w, h); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { wynik[j, i, 0] = bda[j, i, 2]; wynik[j, i, 1] = bda[j, i, 1]; wynik[j, i, 2] = bda[j, i, 0]; } } obraz.UnlockBits(bd); return wynik; } public static Bitmap Byte2Bitmap(byte[, ,] tablica) { if (tablica.GetLength(2) != 3) { throw new NieprawidlowyWymiarTablicyException(); } int w = tablica.GetLength(0); int h = tablica.GetLength(1); Bitmap obraz = new Bitmap(w, h, PixelFormat.Format24bppRgb); for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { Color kol = Color.FromArgb(tablica[i, j, 0], tablica[i, j, 1], tablica[i, j, 2]); obraz.SetPixel(i, j, kol); } } return obraz; } Now, if I do: private void btnLoad_Click(object sender, EventArgs e) { if (dgOpenFile.ShowDialog() == DialogResult.OK) { try { Bitmap img = new Bitmap(dgOpenFile.FileName); byte[, ,] tab = Grafika.Bitmap2Byte(img); picture.Image = Grafika.Byte2Bitmap(tab); picture.Size = img.Size; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } Most of pictures are handled correctly butsome not. Example of picture that doesn't work: It produce following result (this is only fragment of picture) : Why is that?

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >