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

Andrew Lygin

@Andrew Lygin
About
Posts
52
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • struct
    A Andrew Lygin

    The Catalyst wrote:

    True, but they are all read only. None of them implement a set method

    That's wrong. Look at the Point.X for example. You can set it.

    C# csharp visual-studio

  • MdiParent problem [modified]
    A Andrew Lygin

    Hi, ActiveForm is a static property of the Form class that returns currently activated form for the application but not the acitve frmMain instance. So in some cases you try to bind child form to the non-MDI-parent form. To have access to your frmMain form from all your classes you can add static property to it (as in the Singleton pattern):

    class frmMain
    {
    private static frmMain current;
    public static frmMain Current
    {
    get
    {
    return current;
    }
    }
    public frmMain()
    {
    // constructor logic here
    current = this;
    }
    }

    Then you can use this property to construct your MDI-child forms:

    childForm.MDIParent = frmMain.Current;

    C# help question

  • Model View Presenter pattern question
    A Andrew Lygin

    Then I think you should leave this menu logic in the specific view and don't burden Presenter with it. Presenter must describe the logic which is common for all views.

    C# question csharp html winforms com

  • Selection of text in textbox
    A Andrew Lygin

    I think the difference between tab-focus and mouseclick-focus is: 1. When control receives focus by pressing tab the only one action occurs -- receiving focus. At this moment you select all the text and cursor automatically goes to the end of the text. 2. When control receives focus by clicking into the control there are two actions: At first you have behaviour as described at 1. But then control must move cursor to the position where you clicked within the control. And this movement clears the selection. (It looks like you select control with tab and then press arrow key to move cursor within the control.) I don't think you can prevent this behaviour for the common winform textbox without overriding mouse events.

    C# help question

  • DataGridView selection on right click
    A Andrew Lygin

    Hi, Johnny. This CellMouseDown event handler should work:

    private void dataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
    {
    if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0))
    {
    dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
    }
    }

    .NET (Core and Framework) help question

  • Can you help me?
    A Andrew Lygin

    1. Add ToolStripContainer (from Toolbox) to your form. 2. Set toolStripContainer.Dock = All. 3. Add MenuStrip (from Toolbox) to the top of the toolStripContainer. 4. Select menuStrip and type captions for your menu items. 5. Select menu item and add handler to its Click event. 6. Repeat step 5 for all menu items.

    C# question csharp help

  • Hide an event in an inherited class
    A Andrew Lygin

    Make your new event public and use ObsoleteAttribute with two parameters. In this case compiler will return an error when somebody try to use this event.

    [Obsolete("SelectedIndexChanged is obsolete. Use MyNewEvent instead.", true)]
    public new event EventHandler SelectedIndexChanged;

    C# help tutorial question

  • why ths code is not working
    A Andrew Lygin

    It doesn't work because you're calling static method add() using object instance. You needn't create object to call add() method:

    public int calling(int x, int y)
    {
    return add(x,y);
    }

    And you even needn't create object to sum up your numbers:

    public static void Main()
    {
    Console.WriteLine("enter x -->> ");
    int x = int.Parse(Console.ReadLine());

    Console.WriteLine("enter y -->> ");
    int y = int.Parse(Console.ReadLine());
    
    int sum = test.add(x,y); 
    
    Console.WriteLine("the value is --> {0}",sum);
    

    }

    C#

  • Applying Windows colorscheme to controls
    A Andrew Lygin

    Hi, RK. I think System.Drawing.SystemColors class can help you.

    C# windows-admin help question

  • Model View Presenter pattern question
    A Andrew Lygin

    Hi, Judah. 1. Is ShowOurContextMenu() a part of your IView interface? 2. Does your Presenter know about myMenuItem or this is a private part of your view? 3. Does this behaviour common for all views or it is specific only for the concrete view?

    C# question csharp html winforms com

  • Selection of text in textbox
    A Andrew Lygin

    Hi, KC.

    KrunalC wrote:

    I have overridden the getfocus behaviour

    It's better to override OnEnter() method because you have a side effect with your code in OnGotFocus() (1. enter some text into your textbox; 2. go to an another form 3; go back to your form. After this your text will be fully selected. It's not a correct behaviour (although IE uses it in the address bar)).

    KrunalC wrote:

    I could write the above code in the click event of custom control by overriding the base implementation for click but i don't want to do that

    I think you have to do that. But override OnMouseDown() instead of OnClick(). It will be more common behaviour. And you'll have to add some logic there to prevent selection when control already has focus.

    C# help question

  • Tab Control
    A Andrew Lygin

    ma se wrote:

    I don't think there is a tabbed control in .NET 2.0??

    You can find it on the "All Windows Forms" tab in the Toolbox.

    C# database help question

  • Tab Control
    A Andrew Lygin

    You should set tabControl.SelectedIndex instead of using tabPage.Show() method.

    C# database help question

  • windows Display setting
    A Andrew Lygin

    Hi, Salmani. To set your application according to screen resolution you can use System.Windows.Forms.Screen class which provides information about all displays on the system.

    C# question

  • Arrays in C# structs?
    A Andrew Lygin

    Where do you take data for the struct instances? If data are taken from a database then you can create constructor with one parameter (record identifier) and load data within this constructor. Or you can add Load(int id) method to your struct. If data are random then you can add FillRandom() method. And so on.

    C# csharp c++ data-structures question

  • Regarding Textbox, Treeview and ListBox properties
    A Andrew Lygin

    Hi, Aruna. 1. treeview.HideSelection = false. 2. You can a) set form.AcceptButton = btnSend if your form is a dialog or you can b) handle KeyDown event of the textbox:

    private void textbox_KeyDown(object sender, KeyEventArgs e)
    {
    if (e.KeyData == Keys.Enter)
    {
    // Handle Enter here.
    }
    }

    C# help

  • how to make transparent control above video?
    A Andrew Lygin

    You can use a transparent (TransparencyKey = BackColor) form above your panel.

    .NET (Core and Framework) csharp game-dev help dotnet graphics

  • Problem when adding to a SplitContainer
    A Andrew Lygin

    Hi, Mahesh. If you want to create a classic MDI application then you shouldn't use SplitterPanel in your main form. You just need to follow next steps: 1. Set MainForm.IsMdiContainer = true. 2. Add a TreeView to the MainForm and set treeView.Dock = Left. 3. Add a Splitter to the MainForm and set splitter.Dock = Left. 4. When you need to create MDI child use this:

    ChildForm child = new ChildForm();
    child.MdiParent = this;
    child.Show();

    C# help

  • Resize quastion (Spliter)
    A Andrew Lygin

    You should use panels to do this. You must have at least two panels on your form. If you use VS 2005 than you can simply use SplitContainer control. If not then: 1. Add panel1 to the form and set panel1.Dock = Top. 2. Add splitter1 to the form and set splitter1.Dock = Top. 3. Add panel2 to the form and set panel2.Dock = Fill. 4. Add treeview1 to the panel1 and set treeview1.Dock = Left. 5. Add splitter2 to the panel1 and set splitter2.Dock = Left. 6. Add listbox1 to the panel1 and set listbox1.Dock = Fill. 7. Do steps 4-6 for the panel2.

    C# question help

  • How can I display a .mht file on a webBrwoser control?
    A Andrew Lygin

    Hi, do you use AxWebBrowser? If yes then webBrowser.Navigate("some.mht", ...) will do this work.

    C# question help
  • Login

  • Don't have an account? Register

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