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. Managed C++/CLI
  4. CLR,How to modify the AutoScrollMinSize of Form1 by coding? [modified]

CLR,How to modify the AutoScrollMinSize of Form1 by coding? [modified]

Scheduled Pinned Locked Moved Managed C++/CLI
dotnettutorialquestion
3 Posts 3 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.
  • A Offline
    A Offline
    akira32
    wrote on last edited by
    #1

    I want to modify the AutoScrollMinSize of Form1 by the code as below:

    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
    {
    this->AutoScrollMinSize.Width=1000;
    this->AutoScrollMinSize.Height=1000;
    }

    But it still not be active. Could somebody know how to modify the AutoScrollMinSize of Form1? PS:already set Form1's AutoScroll as True.

    modified on Tuesday, November 17, 2009 3:24 AM

    L L 2 Replies Last reply
    0
    • A akira32

      I want to modify the AutoScrollMinSize of Form1 by the code as below:

      private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
      {
      this->AutoScrollMinSize.Width=1000;
      this->AutoScrollMinSize.Height=1000;
      }

      But it still not be active. Could somebody know how to modify the AutoScrollMinSize of Form1? PS:already set Form1's AutoScroll as True.

      modified on Tuesday, November 17, 2009 3:24 AM

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      a Size is a struct, hence a value type; you can't just modify part of it to modify the object. Assign a new Size with the width AND height you want. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      1 Reply Last reply
      0
      • A akira32

        I want to modify the AutoScrollMinSize of Form1 by the code as below:

        private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
        {
        this->AutoScrollMinSize.Width=1000;
        this->AutoScrollMinSize.Height=1000;
        }

        But it still not be active. Could somebody know how to modify the AutoScrollMinSize of Form1? PS:already set Form1's AutoScroll as True.

        modified on Tuesday, November 17, 2009 3:24 AM

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Size is a struct, so when you directly modify its properties, you are actually modifying a copy of it. (Actually modifying two copies of it in your code, one for width and another for height :)). Use something like this:

        this->AutoScrollMinSize = gcnew Size(1000,1000);

        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