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
  1. Home
  2. General Programming
  3. C#
  4. Minimize problem

Minimize problem

Scheduled Pinned Locked Moved C#
helpquestion
14 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C CoolASL

    Hi Peshkunta, Thanks for the reply. I tried adding your code to mine.. But the problem is that there are no properties of the form named as either AutoScaleDimensions or AutoScaleMode: .... this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; .... I searched the MSDN too, but no such property is listed there. At the most, i was able to find AutoScaleBaseSize and ClientSize. Here's my code. Can you please see, if there is anything which i need to add. private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // textBox1 // this.textBox1.BackColor = System.Drawing.Color.White; this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox1.ForeColor = System.Drawing.Color.Black; this.textBox1.Location = new System.Drawing.Point(16, 168); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(269, 16); this.textBox1.TabIndex = 1; this.textBox1.Text = ""; // // richTextBox1 // this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.richTextBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(102)), ((System.Byte)(102)), ((System.Byte)(153))); this.richTextBox1.Location = new System.Drawing.Point(16, 32); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.ReadOnly = true; this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedHorizontal; this.richTextBox1.Size = new System.Drawing.Size(269, 128); this.richTextBox1.TabIndex = 2; this.richTextBox1.Text = ""; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(433, 260); this.BackColor = System.Drawing.Color.Lime; this.ClientSize = new System.Drawing.Size(312, 208); this.Controls.Add(this.richTextBox1); this.Controls.Add(this.textBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; this.Text = "Form1"; this.TransparencyKey = System.Drawing.Color.Lime; this.KeyPreview = true; this.Resize += new System.EventHandler(this.Form1_Resize); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.Load += new System.EventHandler(this.Form1_L

    P Offline
    P Offline
    peshkunta
    wrote on last edited by
    #5

    I think the problem is in the event handler functions Form1_Resize, and the others: this.Resize += new System.EventHandler(this.Form1_Resize); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.Load += new System.EventHandler(this.Form1_Load); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp); this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove); If you can, I would like to see the code in those. I was wondering what method/way you use to minimize the form/dialog since your dialog has no border. Are you using a button, or just a hit-test location on the form to click? If you want to have your own custom minimize button, one easy way to do it is to create a normal button and set it to Flat style, with no text and your image in the button that can change when you press for button being pressed, etc. Make sure the Flat button BorderSize is set to 0 otherwise there will be a border there. And make sure the MouseDownBackColor and MouseOverBackColor are set to Transperent. -- modified at 1:05 Wednesday 28th December, 2005

    C 1 Reply Last reply
    0
    • P peshkunta

      I think the problem is in the event handler functions Form1_Resize, and the others: this.Resize += new System.EventHandler(this.Form1_Resize); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.Load += new System.EventHandler(this.Form1_Load); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp); this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove); If you can, I would like to see the code in those. I was wondering what method/way you use to minimize the form/dialog since your dialog has no border. Are you using a button, or just a hit-test location on the form to click? If you want to have your own custom minimize button, one easy way to do it is to create a normal button and set it to Flat style, with no text and your image in the button that can change when you press for button being pressed, etc. Make sure the Flat button BorderSize is set to 0 otherwise there will be a border there. And make sure the MouseDownBackColor and MouseOverBackColor are set to Transperent. -- modified at 1:05 Wednesday 28th December, 2005

      C Offline
      C Offline
      CoolASL
      wrote on last edited by
      #6

      Hi Peshkunta... Thanks... That was a real help. There is some problem with my code. I had actually used an image which would minimze the window when clicked. i had always wanted to create a custom button. Hey, but i am not able to find any property of the button called as BorderSize, MouseDownBackColor and MouseOverBackColor.. Are you talking about VC or C#..?? Maybe i am missing something.. can you please figure it out. Thanks in advance. Amrit. *** Who said nothing is impossible? I have been doing it for a long time ***

      P 1 Reply Last reply
      0
      • C CoolASL

        Hi Peshkunta... Thanks... That was a real help. There is some problem with my code. I had actually used an image which would minimze the window when clicked. i had always wanted to create a custom button. Hey, but i am not able to find any property of the button called as BorderSize, MouseDownBackColor and MouseOverBackColor.. Are you talking about VC or C#..?? Maybe i am missing something.. can you please figure it out. Thanks in advance. Amrit. *** Who said nothing is impossible? I have been doing it for a long time ***

        P Offline
        P Offline
        peshkunta
        wrote on last edited by
        #7

        I'm using C# - Visual Studio 8 (2005). In the button Properties window look for FlatStyle property. Just above it is a propery called FlatAppearence and in front of the text is a + if you click on it it will expand and show you BorderSize, etc.

        C 1 Reply Last reply
        0
        • P peshkunta

          I'm using C# - Visual Studio 8 (2005). In the button Properties window look for FlatStyle property. Just above it is a propery called FlatAppearence and in front of the text is a + if you click on it it will expand and show you BorderSize, etc.

          C Offline
          C Offline
          CoolASL
          wrote on last edited by
          #8

          Oh great.. No wonder i am not able to find it.:wtf: I am using Visual Studio 7.1 ;) I'll check it out... thanks for the help. Sorry for disturbing you for so long. I realy appreciate your help. Thanks a lot. :cool: *** Who said nothing is impossible? I have been doing it for a long time ***

          P 1 Reply Last reply
          0
          • C CoolASL

            Oh great.. No wonder i am not able to find it.:wtf: I am using Visual Studio 7.1 ;) I'll check it out... thanks for the help. Sorry for disturbing you for so long. I realy appreciate your help. Thanks a lot. :cool: *** Who said nothing is impossible? I have been doing it for a long time ***

            P Offline
            P Offline
            peshkunta
            wrote on last edited by
            #9

            :laugh: Not a problem at all - glad to help. If you don't have the option to do the transparent color in the flat button, alternatively you can use PictureBox or Panel control (I would go with PictureBox) for the same effect. I use PNG files for transparency - if it's transparent in the PNG file it comes out transparent in the button, imagebox, panel etc. Let me know if you find the flat style button transparency property and if you have any other question. You can also make a custom form/dialogbox. So it doesn't have to have the sharp edges - you can have a circle dialog box. If you don't know how to do it and need that, let me know. PS. Look and see if you have these properties: this.button1.FlatAppearance.BorderSize = 0; this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

            C 1 Reply Last reply
            0
            • P peshkunta

              :laugh: Not a problem at all - glad to help. If you don't have the option to do the transparent color in the flat button, alternatively you can use PictureBox or Panel control (I would go with PictureBox) for the same effect. I use PNG files for transparency - if it's transparent in the PNG file it comes out transparent in the button, imagebox, panel etc. Let me know if you find the flat style button transparency property and if you have any other question. You can also make a custom form/dialogbox. So it doesn't have to have the sharp edges - you can have a circle dialog box. If you don't know how to do it and need that, let me know. PS. Look and see if you have these properties: this.button1.FlatAppearance.BorderSize = 0; this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

              C Offline
              C Offline
              CoolASL
              wrote on last edited by
              #10

              Yes.. thats exactly what i am doing.. i have made up the window using some images (using GDI+). That minimize problem was occuring because of the code that i had written for detecting the click on that image used for closing the window. I havent worked down to the root of the problem yet.. i'll do it once i get out of my office. I was actually inspired to make such a custom window when i used Google Talk. Its cool... i have made seperate images for the titlebar, the body and the buttons. I had some problem while customizing the button, so i left it for the meanwhile. So, i use GraphicsPath to bring them all together and compose the window. But i have a problem in store for me... how do i go about writing code to help the user in expanding the window. I mean how to detect when the mouse has been placed on the border of the window and how to expand the window.... because if i do so, the images will be distorted. Can you tell me, how to go about doing it. Or simply put, what approach do you use... (something which i can implement in Visual Studio 7) Thanks !!!! *** Who said nothing is impossible? I have been doing it for a long time ***

              P 1 Reply Last reply
              0
              • C CoolASL

                Yes.. thats exactly what i am doing.. i have made up the window using some images (using GDI+). That minimize problem was occuring because of the code that i had written for detecting the click on that image used for closing the window. I havent worked down to the root of the problem yet.. i'll do it once i get out of my office. I was actually inspired to make such a custom window when i used Google Talk. Its cool... i have made seperate images for the titlebar, the body and the buttons. I had some problem while customizing the button, so i left it for the meanwhile. So, i use GraphicsPath to bring them all together and compose the window. But i have a problem in store for me... how do i go about writing code to help the user in expanding the window. I mean how to detect when the mouse has been placed on the border of the window and how to expand the window.... because if i do so, the images will be distorted. Can you tell me, how to go about doing it. Or simply put, what approach do you use... (something which i can implement in Visual Studio 7) Thanks !!!! *** Who said nothing is impossible? I have been doing it for a long time ***

                P Offline
                P Offline
                peshkunta
                wrote on last edited by
                #11

                That would be more challenging. Normally the skins in a custom app don't change - the app doesn't visually resize. What you could do in that case is have 4 pictureboxes and dock them in each corner. When the app resizes so will the pictureboxes automatically. What you would have to do in that case is make sure the picture of the border/frame is very high resolution/large picture - large enough so that when it explands it won't get pixelated. -- modified at 3:37 Wednesday 28th December, 2005

                C 1 Reply Last reply
                0
                • P peshkunta

                  That would be more challenging. Normally the skins in a custom app don't change - the app doesn't visually resize. What you could do in that case is have 4 pictureboxes and dock them in each corner. When the app resizes so will the pictureboxes automatically. What you would have to do in that case is make sure the picture of the border/frame is very high resolution/large picture - large enough so that when it explands it won't get pixelated. -- modified at 3:37 Wednesday 28th December, 2005

                  C Offline
                  C Offline
                  CoolASL
                  wrote on last edited by
                  #12

                  Hmmm.. that would be nice.. i'll give it a try. Well, you are right that such windows are rarely expandable.. Hey, but look at Google talk window... it is allowed to expand the window there. But very cleverly, they have the background of the window as white... must be some nice trick up their sleeves. Anyway, i'll give it a try and let you know. Thanks for all the cool advice. ;) *** Who said nothing is impossible? I have been doing it for a long time ***

                  P 1 Reply Last reply
                  0
                  • C CoolASL

                    Hmmm.. that would be nice.. i'll give it a try. Well, you are right that such windows are rarely expandable.. Hey, but look at Google talk window... it is allowed to expand the window there. But very cleverly, they have the background of the window as white... must be some nice trick up their sleeves. Anyway, i'll give it a try and let you know. Thanks for all the cool advice. ;) *** Who said nothing is impossible? I have been doing it for a long time ***

                    P Offline
                    P Offline
                    peshkunta
                    wrote on last edited by
                    #13

                    There is a way to make custom controls with custom properties that is much cleaner than this, but it requires more code. Google talk doesn't seem hard to make, with exception of the semitransparent shadow if this shadow is not caused by the operating system. :doh: Check this out: http://www.ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html -- modified at 4:40 Thursday 29th December, 2005

                    C 1 Reply Last reply
                    0
                    • P peshkunta

                      There is a way to make custom controls with custom properties that is much cleaner than this, but it requires more code. Google talk doesn't seem hard to make, with exception of the semitransparent shadow if this shadow is not caused by the operating system. :doh: Check this out: http://www.ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html -- modified at 4:40 Thursday 29th December, 2005

                      C Offline
                      C Offline
                      CoolASL
                      wrote on last edited by
                      #14

                      thanks man.. its great !!!! *** Who said nothing is impossible? I have been doing it for a long time ***

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

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