Search Results

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

Page 50/113 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Is there a way to get different sizes of the Windows system icons in .NET?

    - by Andrew Watt
    In particular I'd like to be able to get the small (16 x 16) icons at runtime. I tried this: new Icon(SystemIcons.Error, SystemInformation.SmallIconSize) Which supposedly "attempts to find a version of the icon that matches the requested size", but it's still giving me a 32 x 32 icon. I also tried: Size iconSize = SystemInformation.SmallIconSize; Bitmap bitmap = new Bitmap(iconSize.Width, iconSize.Height); using (Graphics g = Graphics.FromImage(bitmap)) { g.DrawIcon(SystemIcons.Error, new Rectangle(Point.Empty, iconSize)); } But that just scales the 32 x 32 icon down into an ugly 16 x 16. I've considered just pulling icons out of the VS Image Library, but I really want them to vary dynamically with the OS (XP icons on XP, Vista icons on Vista, etc.). I'm willing to P/Invoke if that's what it takes.

    Read the article

  • Close box triggers validation for non-modal form

    - by Governor
    I have two form classes inheriting from a common base. One of the forms is called modally and the other non-modally. Validation is required on focus changes but not when the form is cancelled. When the Close Box is selected on the modal form it closes properly without any validation being triggered on it's controls. When the Close Box is selected on the non-modal form, validation events are triggered. A Cancel button with CausesValidation set false works fine in both cases. I have tried setting CausesValidation on the non-modal form to false but the problem remains. I should mention that the forms are mdi children. Any ideas? Thx.

    Read the article

  • find string in DataGridView

    - by LCountee
    I'm using a foreach loop to populate each row in a DataGridView with a string. I need to search the DataGridView to make sure that I don't add a string that is already there. What is the best way to do this? Here is my code so far: foreach (String file in openFileDialog.FileNames) { // todo: make sure file string does not already exist in DataGridView dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells[1].Value = file; i++; }

    Read the article

  • How to disable edit mode on cells but checkbox column?

    - by DanSogaard
    My checkbox column doesn't respond when ticked, apparently it was set to read only, so changing state back to false again will make it possible to tick. However, that will turn the whole edit mode to true. I tried to set edit mode to programatically while setting ReadOnly mode to false, but that will disable the checkbox back again. How can I disable edit mode on all cells except checkbox column?

    Read the article

  • Forcing a checkbox bound to a DataSource to update when it has not been viewed yet.

    - by Scott Chamberlain
    Here is a test framework to show what I am doing: create a new project add a tabbed control on tab 1 put a button on tab 2 put a check box paste this code for its code (use default names for controls) public partial class Form1 : Form { private List<bool> boolList = new List<bool>(); BindingSource bs = new BindingSource(); public Form1() { InitializeComponent(); boolList.Add(false); bs.DataSource = boolList; checkBox1.DataBindings.Add("Checked", bs, ""); this.button1.Click += new System.EventHandler(this.button1_Click); this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); } bool updating = false; private void button1_Click(object sender, EventArgs e) { updating = true; boolList[0] = true; bs.ResetBindings(false); Application.DoEvents(); updating = false; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (!updating) MessageBox.Show("CheckChanged fired outside of updating"); } } The issue is if you run the program and look at tab 2 then press the button on tab 1 the program works as expected, however if you press the button on tab 1 then look at tab 2 the event for the checkbox will not fire untill you look at tab 2. The reason for this is the controll on tab 2 is not in the "created" state, so its binding to change the checkbox from unchecked to checked does not happen until after the control has been "Created". checkbox1.CreateControl() does not do anything because according to MSDN CreateControl does not create a control handle if the control's Visible property is false. You can either call the CreateHandle method or access the Handle property to create the control's handle regardless of the control's visibility, but in this case, no window handles are created for the control's children. I tried getting the value of Handle(there is no public CreateHandle() for CheckBox) but still the same result. Any suggestions other than have the program quickly flash all of my tabs that have data-bound check boxes when it first loads? EDIT-- per Jaxidian's suggestion I created a new class public class newcheckbox : CheckBox { public new void CreateHandle() { base.CreateHandle(); } } I call CreateHandle() right after updating = true same results as before.

    Read the article

  • How can we remove specific string from string ?

    - by Harikrishna
    I will have a different type of string(string will not have fixed format,they will be different every time) from them I want to remove some specific substring.Like the string can be FUTIDX 26FEB2009 NIFTY 0 FUTSTK ONGC 27 Mar 2008 FUTIDX MINIFTY 30 Jul 2009 FUTIDX NIFTY 27 Aug 2009 NIFTY FUT XP: 29/05/2008 Now I want to Remove the string which starts with FUT how can I do that ?

    Read the article

  • One config file for multiple environments

    - by ho
    I'm currently working with systems that has quite a lot of configuration settings that are environment specific (Dev, UAT, Production). Does anyone have any suggestions for minimizing the changes needed to the config file when moving between environments as well as minimizing the duplication of data in the config file? It's mostly Application settings rather than User settings. The way I'm doing it at the moment is something similar to this: <DevConnectionString>xyz</DevConnectionString> <DevInboundPath>xyz</DevInboundPath> <DevProcessedPath>xyz</DevProcessedPath> <UatConnectionString>xyz</UatConnectionString> <UatInboundPath>xyz</UatInboundPath> <UatProcessedPath>xyz</UatProcessedPath> ... <Environment>Dev</Environment> And then I have a class that reads in the Environment setting via the My.Settings class (it's VB project) and then uses that to decide what other settings to retrieve. This leads to too much duplication though so I'm not sure if it's worth it.

    Read the article

  • string <-> int/float conversion pain in .net winform

    - by Benny
    the Text property of control on winform is always string type, so if i wanna expose property of other type for custom control, i have to do the conversion as following, if i have dozens of properties to expose, it will be such pain for me. public int ImageGroupLength { get { return int.Parse(this.imageGroupLength.Text); } set { this.imageGroupLength.Text = value.ToString(); } } so, is there any elegant way to do the conversion?

    Read the article

  • Creating a KeyDown Event Handler for the Label Control

    - by j-t-s
    Hi All I'm sure you're all aware of the fact that the Label Control has no KeyDown handler (and why would it?)... Anyway, I'm in need of a KeyDown handler for the Label Control and would appreciate any pointers/suggestions to get me started. I've searched around but haven't found any info on creating my own Event Handlers for the Label Control. Can this be done is C#? Thanks

    Read the article

  • Create list-of-controls in Windows.Forms

    - by leiflundgren
    I have decided that I would like to have a list with "complex context", i.e. of custom-controls. (The goal is something looking like a buddy list, with photos, status-icons, text, "start-chat-button".) But I like it to behave as a list: scrollbars, possibility to select multiple items etc. When I have been looking at ListView and ListBox I only see that I can add text and an icon, but not arbitrary controls. I'm I missing how this is done? Or should I use something else then ListView/ListBox?

    Read the article

  • Scrollbar still is painted after it should be removed

    - by Walter Williams
    I have the following custom control and can place on a form (with AutoScroll set to true and the control anchored left, top and right). If the form is too short for the control, the form correctly resizes the control (to make room for the scroll) and displays the scroll bar. When the control is closed using the close glyph, the control is resized and the scroll bar is removed, but occasionally the scroll bar appears to remain painted. If the form is minimized or moved off-screen, the leftover paint is removed. I've tried Parent.Invalidate and have toyed with it in many ways but to no avail. Any suggestions? (Using VS 2008 Standard) using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; namespace GroupPanelTest { public class GroupPanel : GroupBox { #region Members private const Int32 iHeaderHeight = 20; private Int32 iFullHeight = 200; private Boolean bClosed = false; private Rectangle rectCloseGlyphBounds = Rectangle.Empty; private Boolean bIsMoveOverCloseGlyph = false; #endregion #region Properties [DefaultValue(false)] public Boolean Closed { get { return (this.bClosed); } set { if (this.bClosed != value) { this.bClosed = value; if (this.bClosed) { this.iFullHeight = base.Height; base.Height = GroupPanel.iHeaderHeight; } else { base.Height = this.iFullHeight; } foreach (Control con in base.Controls) con.Visible = !this.bClosed; this.Invalidate(); } } } public new Int32 Height { get { return (base.Height); } set { if (value != base.Height) { if (this.Closed) { this.iFullHeight = value; } else { Int32 iOldHeight = base.Height; base.Height = value; } } } } [DefaultValue(typeof(Size), "350,200")] public new Size Size { get { return (base.Size); } set { if (base.Size != value) { base.Size = value; if (!this.Closed) this.iFullHeight = value.Height; } } } [DefaultValue(typeof(Padding), "0,7,0,0")] public new Padding Padding { get { return (base.Padding); } set { base.Padding = value; } } #endregion #region Construction public GroupPanel () { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.Selectable, true); this.Size = new Size(350, 200); this.Padding = new Padding(0, 7, 0, 0); // the groupbox will add to that this.rectCloseGlyphBounds = new Rectangle(base.ClientSize.Width - 24, 2, 16, 16); } #endregion #region Overrides protected override void OnSizeChanged (EventArgs e) { this.rectCloseGlyphBounds = new Rectangle(base.ClientSize.Width - 24, 2, 16, 16); base.OnSizeChanged(e); } protected override void OnPaint (PaintEventArgs e) { base.OnPaint(e); // we want all the delegates to receive the events, but we do this first so we can paint over it Graphics g = e.Graphics; g.FillRectangle(SystemBrushes.Window, this.ClientRectangle); Rectangle rectTitle = new Rectangle(0, 0, this.ClientRectangle.Width, GroupPanel.iHeaderHeight); g.FillRectangle(SystemBrushes.Control, rectTitle); g.DrawString(this.Text, this.Font, SystemBrushes.ControlText, new PointF(5.0f, 3.0f)); if (this.bIsMoveOverCloseGlyph) { g.FillRectangle(SystemBrushes.ButtonHighlight, this.rectCloseGlyphBounds); Rectangle rectBorder = this.rectCloseGlyphBounds; rectBorder.Inflate(-1, -1); g.DrawRectangle(SystemPens.Highlight, rectBorder); } using (Pen pen = new Pen(SystemColors.ControlText, 1.6f)) { if (this.Closed) { g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 3, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 8); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 3, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 8); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 7, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 12); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 7, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 12); } else { g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 8, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 3); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 8, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 3); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 12, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 7); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 12, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 7); } } } protected override void OnMouseDown (MouseEventArgs e) { if (e.Button == MouseButtons.Left && this.rectCloseGlyphBounds.Contains(e.Location)) this.Closed = !this.Closed; // close will call invalidate base.OnMouseDown(e); } protected override void OnMouseMove (MouseEventArgs e) { this.bIsMoveOverCloseGlyph = this.rectCloseGlyphBounds.Contains(e.Location); this.Invalidate(this.rectCloseGlyphBounds); base.OnMouseMove(e); } #endregion } }

    Read the article

  • Change TreeNode image on expand-collapse events

    - by Alexander Stalt
    I have a treeView with many nodes. I want that some nodes change their image when node collapsed/expanded. How can I do it ? Unfortunately, TreeNode don't have properties like ExpandNodeImage, CollapseNodeImage \ TreeView can change very often, so nodes can be deleted/added.. i can delete child nodes and so on... Maybe, there is a class like ExpandAndCollapseNode ?

    Read the article

  • Form.ShowDialog() does not show form.

    - by clawson
    I've come across a situation where I try to run a simple line of code in a method Dim res As DialogResult = frmOptions.ShowDialog() but nothing happens. The dialog box will not appear. If I run this method from another location in the code it executes fine (i.e. displays the form in dialog mode and code executes fine thereafter). Hence, it may be the way in which I arrive at this code that is causing my problem, but I cannot see to find what is wrong. When I pause the debugger the line of code is highlighted in green but I can't see to step over it or into it. Any idea what may cause this to happen, or what I should be looking for that might be causing the problem?? Thanks for the help!

    Read the article

  • Windows theme affecting ListView header

    - by LihO
    I've created new Windows Forms Application (C#) with one simple form containing ListView. Then I changed the View Property to Details and increased the size of the font used in this ListView and here's the result: This is how it looks on Windows XP with Windows Classic theme: and here's the result with Windows XP theme: Creating the same Windows Forms Application in Visual C++ instead of C# yields same result. EDIT : Thanks to Kamil Lach, we already know that Visual Styles is what makes the appearance of ListView change. This can be avoided either by removing Application.EnableVisualStyles() call or by changing the Application.VisualStyleState. Both of these solutions yield the following result: This looks fine, but this change affects the appearance of other controls which is not good. I'd like my ListView to be the only control that is not affected by Visual Styles. I've also found similar questions that try to deal with it: Can you turn off visual styles/theming for just a single windows control? How do I disable visual styles for just one control, and not its children? Unfortunately, none of mentioned solutions works. Any C# solution that would make the ListView header have the correct height would be appreciated.

    Read the article

  • How to add a margin to a CheckedListBox in .NET?

    - by Xanatos
    I'm writing an windforms application using .NET (actually IronPython, but that's not relevant), and I have a CheckedListBox object in my GUI. It's working fine, it has about 20 items in a multicolumn layout. But I can't figure out how to give the thing a nice internal margin--I want to insert around 20 or 30 pixels of whitespace around the top, bottom, left, and right edges of the checkboxes. To be clear, I want the whitespace to appear between the border of the CheckedListBox and the Checkboxes inside it, not outside the whole component. Hopefully this is an easy answer, and I'm just missing it cause I'm new to programming in windows. If its not possible, I guess that'd be good to know too, so I don't waste anymore time with it. (If I were doing this in Swing (Java) I would be looking to set the Insets on my component, or maybe build up a compound border with some empty space in it.)

    Read the article

  • How To Create a Custom List of ProgressBars in .Net 2.0

    - by user205077
    I have created a progress bar custom control and would like to embed this into a list which can be sorted and placed on a windows form using .Net 2.0. What is the best approach for this? Is it possible to just add it to a ListView as a subitem? Is there a better way to achieve this? I want it to be as lightweight as possible.

    Read the article

  • flash player embedded in asp page which is opened in webbrowser control in .NET access through windo

    - by Prit
    I am develoing a windows application in C#.NET. In one of my winform I have added a WebBrowser control. In this webbrowser control I have opened an asp page from my local website. Now in this webpage there is one flash object which is used to play swf files. Now my question is can I access this control from my winform? If so then how? can u create a handler for that flash object?

    Read the article

  • What is the Browser version of a WebBrowser control in Windows Forms

    - by Chris Roberts
    I'm building a Windows Forms application which makes use of the WebBrowser control. Can anyone tell me what rendering engine the control uses? Is it fixed based on the version of the .NET framework I'm developing against or is it based on the version of IE installed on the client's machine? Does the client even need IE? In other words, if a website looks right in my application on my machine, is it reasonably safe to assume it'll render right on everyone else's machine? Thanks!

    Read the article

  • Problem with virtual mouse click

    - by Alex
    Hi. I have a program that simulates mouse click. Code is something like this: [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo); private const int MOUSEEVENTF_LEFTDOWN = 0x02; private const int MOUSEEVENTF_LEFTUP = 0x04; public static void DoMouseClick(int x, int y) { Cursor.Position = new Point(x, y); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, x, y, 0, 0); } This code works perfectly. For example I call this function every 30 minutes. But if I press WINKEY+L (Windows is locked) only cursor is moved but not press occurs. Any ideas?

    Read the article

  • How to collect user opinions about software

    - by alga
    I have written a small .net Windows Forms application. And now I decided to get opinions or comments from users. User will just write something in a input form and click a send button. I want to use the most easiest way. I don't want to host any webservices or another applications for gathering the information. Also I don't have a database. Nothing. I just want to know what people think about the application. How would you do it?

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >