[ Pobierz całość w formacie PDF ]
.llW poszczególnych kontrolkach ustawiane są odpowiednio właściwości Top i Left, a właściwość Visible ustawiona zostaje na true.lMimo iż wygląda to znacznie mniej skomplikowanie, niż początkowo się wydawało, to jednak sama funkcja ArrangeControlBarBands() jest na swój sposób złożona.Nie jest ona jednak doskonała i może być usprawniona; ponadto nasz pasek kontrolny nie jest podzielony na kolumny, więc przemieszczanie kontrolek może wydawać się zbędne - niemniej jednak funkcja ta ilustruje ogólny algorytm wyrównywania kontrolek podzielonych na wstęgi.Wydruk 3.33.Definicja klasy TControlBandInfoclass TControlBandInfo{public:TControl* Control;int Left;int Top;int Height;bool Visible;// konstruktorinline __fastcall TControlBandInfo() : Control(0),Left(0),Top(0),Height(0),Visible(false){}// konstruktor kopiującyinline __fastcall TControlBandInfo(TControl* control,int left,int top,int height,bool visible) : Control(control),Left(left),Top(top),Height(height),Visible(visible){}// konstruktor kopiującyinline __fastcall TControlBandInfo(const TControlBandInfo& ControlBandInfo): Control(ControlBandInfo.Control),Left(ControlBandInfo.Left),Top(ControlBandInfo.Top),Height(ControlBandInfo.Height),Visible(ControlBandInfo.Visible){}// OPERATOR =TControlBandInfo& operator=(const TControlBandInfo& ControlBandInfo){Control = ControlBandInfo.Control;Left = ControlBandInfo.Left;Top = ControlBandInfo.Top;Height = ControlBandInfo.Height;Visible = ControlBandInfo.Visible;return *this;}// OPERATOR ==bool operator==(const TControlBandInfo& ControlBandInfo) const{if( Control == ControlBandInfo.Control&& Left == ControlBandInfo.Left&& Top == ControlBandInfo.Top&& Height == ControlBandInfo.Height&& Visible == ControlBandInfo.Visible){return true;}else return false;}// OPERATOR <bool operator<(const TControlBandInfo& ControlBandInfo) const{if(Top < ControlBandInfo.Top) return true;else if( Top == ControlBandInfo.Top&& Left < ControlBandInfo.Left) return true;else return false;}// OPERATOR >bool operator>(const TControlBandInfo& ControlBandInfo) const{if(Top < ControlBandInfo.Top) return true;else if( Top == ControlBandInfo.Top&& Left > ControlBandInfo.Left) return true;else return false;}};Jedyną różnicą pomiędzy wyrównywaniem pojedynczej kontrolki a wyrównywaniem wszystkich kontrolek paska kontrolnego jest ta, iż w tym drugim przypadku należy wywołać funkcję ArrangeControlBarBands() dla każdej kontrolki.Wydruk 3.34 przedstawia funkcję dokonującą prawostronnego wyrównania wszystkich kontrolek, wywoływaną w reakcji na wybranie opcji Align All Right [ Pobierz całość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • trzylatki.xlx.pl