Search Results

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

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

  • Problem with moving a winform using C#

    - by karthik
    My form doesn't have a title bar, so I am implementing the code to drag the entire form around the screen. I am using the below code to do it, which works fine. I have two panels in my form, PanelA and PanelB. During the startup I show PanelA where the dragging works perfectly. Later when the user clicks the button in PanelA, I need to make PanelA invisible and show PanelB However, the dragging does not work when PanelB is shown. What's the problem here? private void SerialPortScanner_MouseUp(object sender, MouseEventArgs e) { this.drag = false; } private void SerialPortScanner_MouseDown(object sender, MouseEventArgs e) { this.drag = true; this.start_point = new Point(e.X, e.Y); } private void SerialPortScanner_MouseMove(object sender, MouseEventArgs e) { if (this.drag) { Point p1 = new Point(e.X, e.Y); Point p2 = this.PointToScreen(p1); Point p3 = new Point(p2.X - this.start_point.X, p2.Y - this.start_point.Y); this.Location = p3; } }

    Read the article

  • vb.net add text to form without interaction

    - by user228058
    I have a winform project which lists all the files in a specified folder. It allows the user to select a new destination for each file, and when the user has chosen the destinations for all files that he would like to be moved, it moves the files, one by one. My next step is, I need to display a confirm form when the files are being moved, and add each file's name and destination to the confirm form as it is being moved. My question is: How can I add more text to the confirm form's controls after I already loaded it (using confirm.showdialog() from my other form, without any user interaction? I imagine that I need to do it from the original form, because it needs to display each one when it starts to move that file, but I'm open to any suggestions:) TIA

    Read the article

  • On XP, how do I get the tooltip to appear above a transclucent form?

    - by Daniel Stutzbach
    I have an form with an Opacity less then 1.0. I have a tooltip associated with a label on the form. When I hover the mouse over the label, the tooltip shows up under the form instead of over the form. If I leave the Opacity at its default value of 1.0, the tooltip correctly appears over the form. However, my form is obviously no longer translucent. ;-) I have tried manually adjusting the position of the ToolTip with SetWindowPos() and creating a ToolTip "by hand" using CreateWindowEx(), but the problem remains. This makes me suspect its a Win32 API problem, not a problem with the Windows Forms implementation that runs on top of Win32. Why does the tooltip appear under the form, and, more importantly, how can I get it to appear over the form where it should? Edit: this appears to be an XP-only problem. Vista and Windows 7 work correctly. I'd still like to find a workaround to get the tooltip to appear above the form on XP. Here is a minimal program to demonstrate the problem: using System; using System.Windows.Forms; public class Form1 : Form { private ToolTip toolTip1; private Label label1; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } public Form1() { toolTip1 = new ToolTip(); label1 = new Label(); label1.Location = new System.Drawing.Point(105, 127); label1.Text = "Hover over me"; label1.AutoSize = true; toolTip1.SetToolTip(label1, "This is a moderately long string, " + "designed to be very long so that it will also be quite long."); ClientSize = new System.Drawing.Size(292, 268); Controls.Add(label1); Opacity = 0.8; } }

    Read the article

  • Is both approach same ?

    - by Harikrishna
    I have one datatable which is not bindided and records are coming from the file by parsing it in the datatable dynamically every time. Now there is three columns in the datatable Marks1,Marks2 and FinalMarks. And their types is decimal. Now for making addition of columns Marks1 and Marks2 's records and store it into FinalMarks column,For that what I do is : datatableResult.Columns["FinalMarks"].Expression="Marks1+Marks2"; It's works properly. It can be done in other way also is foreach (DataRow r in datatableResult.Rows) { r["FinalMarks"]=Convert.ToDecimal(r["Marks1"])+Convert.ToDecimal(r["Marks2"]); } Now I don't know that which is the best way to do this means performance wise. Is first approach same as second approach in background means is both approach same or what?

    Read the article

  • Two List Boxes side by side and stretchable

    - by Ilya Biryukov
    I have two list boxes like show below, side by side. They both have anchors on top, bottom, left and right. When I stretch the window the left listbox grows over the right one. While I want the margin between them to stay and for both listboxes to expand evenly. Is there anyway to achieve this? Thanks!

    Read the article

  • Preselection in the save dialog (c#)

    - by FullmetalBoy
    Goal: Save a notepad file in the computer. (C#) Problem: I don't know how to make a preselection as "TXT Files(*.txt)" in the "Save as type:" when save dialog display? // Fullmetalboy using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace Labb2_application { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void mnuFileOpen_Click(object sender, EventArgs e) { OpenFileDialog fDialog = new OpenFileDialog(); fDialog.Title = "Öppna"; fDialog.Filter = "Text files|*.txt"; fDialog.InitialDirectory = @"C:\Windows"; fDialog.ShowHelp = true; DialogResult result = fDialog.ShowDialog(); // Show the dialog and get result. if (result == DialogResult.OK) { string fileAdress = fDialog.FileName; try { string textContent = File.ReadAllText(fileAdress); rtxtDisplay.Text = textContent; } catch (IOException) { } } // If syntax } private void mnuFileSave_Click(object sender, EventArgs e) { saveAsFileDialog.ShowDialog(); } private void mnuFileSaveAs_Click(object sender, EventArgs e) { saveAsFileDialog.Filter = "Text files|*.txt"; saveAsFileDialog.ShowDialog(); } private void mnuFileExit_Click(object sender, EventArgs e) { Application.Exit(); } private void saveAsFileDialog_FileOk(object sender, CancelEventArgs e) { string fileNameAddress = saveAsFileDialog.FileName; File.WriteAllText(fileNameAddress, rtxtDisplay.Text); } } // Partial Class }

    Read the article

  • DataGridView update datasource directly after changed Checkbox value

    - by SchlaWiener
    I have a System.Windows.Forms DataGridView that is bound to a List<MyObject>. The class MyObject contains a boolean property that is bound to DataGridViewCheckboxCell within the DataGridView. public class MyObject { public decimal DefaultValue {get; set; } public bool HasCustomValue {get;set; } public decimal CustomValue {get;set; } public decimal CurrentValue { get { return HasCustomValue ? CustomValue : DefaultValue; } } If I change the value of HasCustomValue another (readonly) property CurrentValue changes it's value, too. That is done by implementing the INotifyPropertyChanged event (I left that part in the source example for simplicity) If I changed HasCustomValue from outside the DataGridView, the column bound to CurrentValue gets updated immediately. Howevery, If the users enables/disables the checkbox, HasCustomValue is not changed in the underlying datasource unless he leaves the column by clicking with the mouse or pressing the TAB key. Is there a way to force the grid to update the datasource directly after changing a checkbox value? If I bind a Control Property I have the ability to set the DataSourceUpdateMode to Windows.Forms.DataSourceUpdateMode.OnPropertyChanged but I haven't found anything like that in a DataGridView

    Read the article

  • n how to show cascade windows in Splitcontainer panel2 c#

    - by user1875373
    In MdiParent toolstripmenuItem, I'm writing the code to show all the windows in cascade or Tile Horizontal style. My code is: this.LayoutMdi(MdiLayout.Cascade); this.LayoutMdi(MdiLayout.TileHorizontal); This code will work in mdi parent only. But now I'm using a Split container in my Parent Form. In Panel1 I have buttons to Show the Form. In Panel2 My Forms will display, as: Forms.paymentPaid paidFm = new SalesandPurchases.Forms.paymentPaid(); paidFm.MdiParent = this; paidFm.Left = (this.myPanel.Width - paidFm.Width) / 2; paidFm.Top = (this.myPanel.Height - paidFm.Height) / 2; myPanel.Controls.Add(paidFm); paidFm.Show(); Now Because of my Split Container my code( this.LayoutMdi(MdiLayout.Cascade)) is not working for cascade the windows in Panel2. Please tell me any other way.

    Read the article

  • Update Multiple Tables at a Time - SQL Server/T-SQL

    - by peace
    I have two tables, Customer and CustomerPhone. Single record in Customer can have multiple CustomerPhone records. As you see in the image below, Phone and Fax resides in CustomerPhone table whereas the rest of the fields resides in Customer table. If user want to edits a customer record, obviously i will have to update the record in Customer table and at least two records from CustomerPhone (Phone and Fax). I could write two update statements, one Update customerPhone and the second update Customer table. Is there a better solution?

    Read the article

  • Determine when and which character is added or deleted in a Text Box.

    - by Alon
    I have a simple text box in a WPF application. I need to know when a character was added/deleted in the text box, which character and where it was added or deleted. I thought to use the TextBox.KeyDown event, but it has some problems: I can't know where the character was added or deleted. I have no idea how to determite which character was added (from the KeyEventArgs). Any ideas? I don't care to use a completely different solution from what I thought. In addition, I've just started this project so I don't care to use Windows Forms instead of WPF if your solution requires it. Thank you.

    Read the article

  • Get label height for fixed width

    - by Jonas
    Is there any way I can get the height of a label, if it hypothetically had a certain width? I've been trying with control.GetPreferredSize(size) like so: Dim wantedWidth as Integer = 100 dim ctrlSize as Size = label.GetPreferredSize(new Size(wantedWidth, 0)) because I thought that setting height = 0, would indicate a free height, but the height I get is way too small. I also tried to estimate the height of the label, using Graphics.MeasureString to calculate the equivalent area of the Label dim prefWidth as Integer = 100 dim estSize as SizeF = g.MeasureString(label.Text, label.Font) dim estHeight as Integer = (Integer)(estSize.Width * estSize.Height / prefWidth) but that yields the same result. Any ideas? I'm on .NET 2.0, unfortunately.

    Read the article

  • Call Dispose() on a WindowsIdentity object? C#

    - by Andy
    I am retrieving a WindowsIdentity object by calling: win_id = System.Security.Principal.WindowsIdentity.GetCurrent(); with the intention of getting the currently logged on user name, which works fine. WindowsIdentity implements IDisposable, but since I din't create the object myself, do I still need to call .Dispose() on it when I am finished with it or not? Thanks.

    Read the article

  • Err Web Service?

    - by j-t-s
    Hi All I am trying to implement a feature. But I've never had anything to do with "Web Services" before, other than using them. I have a desktop application, and I want that application to be able to sort of "post" some information (i.e. email address, username, user-selected options (just plain text) etc) to an application or "web service" on my ASP.NET web server. Can somebody please guide me in the right direction? How would I accomplish this? Thank you :) Jason

    Read the article

  • What is the best way to embed controls in a list/grid

    - by Brad
    I have a table of about 450 rows that I would like to display in a graphical list for users to view or modify the line items. The users would be selection options from comboboxes and selecting check boxes etc. I have found a listview class that extends the basic listview to allow for embeding objects but it seems kind of slugish when I load all the rows into it. I have used a datagridview in the past for comboboxes and checkboxes, but there was a lot of time invested in getting that up and running...not a big fav of mine. I am looking for sugestions how I can do this with minimal overhead. thanks c#, vs2008, .net 2.0, system.windows.forms

    Read the article

  • PropertyGrid control issue in Windows7

    - by Mahesh
    I have an issue with the Windows Forms PropertyGrid control. I have customized the PropertyGrid control and override only OnPaint function. protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } In my application I have few more controls (treeview, custom control and few form controls). When I mouseclick on the PropertyGrid control, the paint function in all the controls in the screen are being called continuously and the treeview starts flickering. This happens only in mouseclick event.

    Read the article

  • Best practices for displaying large number of images as thumbnails in c#

    - by andySF
    I got to a point where it's very difficult to get answers by debugging and tracing object, so i need some help. What I'm trying to do: A history form for my screen capture pet project. The history must list all images as thumbnails (ex: picasa). What I've done: I created a HistoryItem:UserControl. This history item has a few buttons, a check box, a label and a picture box. The buttons are for delete/edit/copy image. The check box is used for selecting one or more images and the label is for some info text. The picture box is getting the image from a public property that is a path and a method creates a proportional thumbnail to display it when the control has been loaded. This user control has two public events. One for deleting the image and one for bubbling the events for mouse enter and mouse leave trough all controls. For this I use EventBroadcastProvider. The bubbling is useful because wherever I move the mouse over the control, the buttons appear. The dispose method has been extended and I manually remove the events. All images are loaded by looping a xml file that contains the path of all images. For each image in this XML I create a new HitoryItem that is added (after a little coding to sort and limit the amount of images loaded) to a flow layout panel. The problem: When I lunch the history form, and the flow layout panel is populated with my HistoryItem custom control, my memory usage increases drastically.From 14Mb to around 100MB with 100 images loaded. By closing the history form and disposing whatever I could dispose and even trying to call GC.Collect() the memory increase remain. I search for any object that could not be disposed properly like an image or event but wherever I used them they are disposed. The problem seams to be from multiple sources. One is that the events for bubbling are not disposing properly, and the other is from the picture box itself. All of this i could see by commenting all the code to a limited version when only the custom control without any image processing and even events is loaded. Without the events the memory consumption is reduced by axiomatically 20%. So my real question is if this logic, flow layout panels and custom controls with picture boxes, is the best solution for displaying large amounts of images as thumbnails. Thank you!

    Read the article

  • Newline not showing correctly in textbox

    - by TheGateKeeper
    I am loading a string from my database which among other things contains line breaks (\r\n). However, this isn't being rendered as a new line but instead as \r\n. If I type it directly in instead of loading it from a string, it works just fine but I need to be able to load it from a string. Any ideas? Edit: Upon closer inspection, it looks like the string is being returned as: Changed test7\\r\\nChanged test8\\r\\nChanged test9Changed test7 From the database. I tried running a .Replace(@"\\", @"\") on it but this had no effect at all. Any ideas?

    Read the article

  • Re-Inventing The Label Control

    - by j-t-s
    Hi All, I need to reinvent/recreate the Label Control from scratch to add my own mojoness to it. Yes, I know what you're thinking (and if you're not thinking that, shouldn't you be?). Can somebody point me in the right direction? Thank you.

    Read the article

  • doublebuffering not reducing the flicker

    - by fishhead
    I am drawing an grid-work of objects in a Panel. when I scroll the the panel quickly I get a flicker. I thought that enabling the double buffering may take care of this but what I find is that it does not completely draw everything and I am left with blank sections. could anyone give me suggestions as to what may be happening and how I might correct it. UPDATE: I found that I was creating the graphics object with Creategraphics() rather than using the Parameter in the paint method

    Read the article

  • ASP.Net WebSite Membership AND C# Windows Form Membership

    - by user1638362
    This is not real, it's just a project i'm working on I've created a Hotel Management system in C# WindowsForm, it allows staff members to Add/Edit/Update Rooms,Reservation and Customers etc. Along side this Windows-form i'm creating an ASP.net WebSite where customers should be able to register and reserve rooms online. I've come to the point where i need to create some-type of membership method for this website which should correspond to the membership of the windows form. However i'm not sure what method of membership would be best suited for this, i have looked into the asp.net membership, it's what i want however it creates it's own schema and i don't know how i can relate the information to my customers table and c#windows form. I would ideally like it to resemble a real-life situation as much as possible anyway, am i going about this the wrong way? in terms of the c# windows-form what other technology would a business use to manage a system like this where they can add/edit/update there system and have a website which relates. What are my options here?

    Read the article

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