C# – Some questions about Windows Forms

Code with C | Programming: Projects & Source Codes Forums C# Programming C# – Some questions about Windows Forms

This topic contains 1 reply, has 1 voice, and was last updated by  SapnaVishwas 2 years, 6 months ago.

  • Author
    Posts
  • #10932

    GloriaFine
    Member

    I’m a total newbie in C# and I started creating an application for my image host. It’s going pretty good, except for some stuff that I’m going to ask …

    • How do I position a Windows Form to the bottom-right of the page when it gets open, instead of top-left?
      Situation: I have a Form1 which doesn’t actually do anything as a form, I just used it for its context menu (my app works from the tray only). So, most of the main running code goes into the Form1 class. When a context menu is clicked, it will do some processing and in the end it will show Form2. So Form2 gets opened/called by a context menu item of Form1. How do I change Form2’s position in this case?
    • How do I save the current view of my monitor (aka Print Screen) and then save that file to some temporary space?
    • How do I open some kind of crop view, so the user can make a selection of the screen and then create an image out of the selection?
    • How do I add keyboard shortcuts for those Upload tasks of my app, so users can start using the app immediately without having to go and right click the tray icon?
  • #10933

    SapnaVishwas
    Member

    Question 1:

    Play around with the “location” on the Form 1’s properties:
    (it’s 0,0 by default)

    Question 3:

    I would imagine you’d have to create a method that does something like this:

    record initial position in the x axis and in the y axis

    record final position in both the x and y axis

    then do:

    final position – initial position (for both axis)

    then

    use the initial position and then add the difference of the final position – initial position

    and that’s the distance you’ll crop for your image

    Question 4:

    I only know how to do this with open forms and it’s in the “KeyPress” event of the form

You must be logged in to reply to this topic.