Inhalt aufpopen lassen c#

  • C#

Es gibt 3 Antworten in diesem Thema. Der letzte Beitrag () ist von ErfinderDesRades.

    Inhalt aufpopen lassen c#

    Moin,

    Ist es möglich sowas wie ein Tooltip mit Labels, Textbox, Button an einer definierten Stelle einer Form nach Buttonklick aufpopen zu lassen. Sowas wie eine Form an definierter Stelle einer Form?

    Beispielsweise nach Buttonklick auf "Drucken", kommt ein kleines fensterlein wo man die Seitenzahl eingeben kann...
    evtl hat ja jemand eine Idee :) Eine Textbox einfach auf Visible zu stellen sieht nicht wirklich gut aus... hat schlicht zuwenig Platz auf der Form...
    Hi @newsletter

    Das mit den kleinen Fenster klingt doch OK. Was spricht dagen, z.B. eine Ramenlose Form zu verwenden?
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."
    @newsletter
    ich habe sowas mal bei einer DataGridView gemacht, bei doppelklick auf Zelle, wurde ein stück weiter unten
    eine Form geöffnet mit Optionen etc.

    Diesen Code auf dich und deine Objekte anpassen:

    C#-Quellcode

    1. #region ShowCellInformation
    2. // Get Cell Data and create temporary form
    3. private void CellOptionWindow(int rowIndex, int columnIndex, int _X, int _Y)
    4. {
    5. var rect = dgv.GetCellDisplayRectangle(columnIndex, rowIndex, true);
    6. OptionWindow celloptions = new OptionWindow(_X, _Y);
    7. celloptions.Show();
    8. }
    9. // Pulls Information from the Cell and its siblings
    10. private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
    11. {
    12. try
    13. {
    14. CellOptionWindow(e.RowIndex, e.ColumnIndex, Cursor.Position.X, Cursor.Position.Y - 20);
    15. }
    16. catch (Exception ex)
    17. {
    18. if (!(ex is System.ArgumentOutOfRangeException))
    19. {
    20. MessageBox.Show(ex.Message.ToString());
    21. }
    22. }
    23. }
    24. #endregion



    Und diesen Code auch anpassen(das ist die Form die dann aufpoppt):

    C#-Quellcode

    1. public partial class OptionWindow : Form
    2. {
    3. private int PosX;
    4. private int PosY;
    5. public OptionWindow(int x, int y)
    6. {
    7. InitializeComponent();
    8. this.PosX = x;
    9. this.PosY = y;
    10. }
    11. // Set the Position of the Form
    12. // and Populate the Listview with data
    13. private void CellOptions_Load(object sender, EventArgs e)
    14. {
    15. this.SetDesktopLocation(PosX, PosY);
    16. }