Модераторы: Partizan, gambit
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Button.Visible не работает 
V
    Опции темы
oleg_in62
Дата 31.5.2012, 14:58 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 23
Регистрация: 5.3.2008

Репутация: нет
Всего: нет



добрый день, в общем ситуация такая, не всегда работает установка видимости кнопки System.Windows.Forms.Buttons, если написать
Код

bRev.Visible=true;


то свойство Visible все равно останется false, причем это происходит не со всеми кнопками на форме

PM MAIL   Вверх
Fortnox
Дата 31.5.2012, 17:09 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 373
Регистрация: 31.10.2008
Где: Ростов-на-Дону

Репутация: 2
Всего: 22



Проверьте состояние такого же свойства у родительского элемента.
PM MAIL   Вверх
oleg_in62
Дата 7.6.2012, 12:58 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 23
Регистрация: 5.3.2008

Репутация: нет
Всего: нет



в смысле родительского элемента? кнопка на форме, свойство Visible невозможно поменять с false на true, при том что оно в конструкторе формы выставлено в true. Мне нужно просто прятать кнопку, при определенных условиях, или отображать, но она почему-то спрятана всегда
PM MAIL   Вверх
Fortnox
Дата 8.6.2012, 14:55 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 373
Регистрация: 31.10.2008
Где: Ростов-на-Дону

Репутация: 2
Всего: 22



Кнопка лежит в каком-нибудь еще контроле?
Если просто на форме, покажите код дизайнера формы и конструктора формы.
PM MAIL   Вверх
oleg_in62
Дата 8.6.2012, 15:54 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 23
Регистрация: 5.3.2008

Репутация: нет
Всего: нет



кнопка просто на форме. В принципе проблему решил, но через костыли, но это не по паттерну, который используем. так что свойство bRev.Visible на данный момент false

Код

partial class CertView
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CertView));
            this.bCertLoad = new System.Windows.Forms.Button();
            this.panel1 = new System.Windows.Forms.Panel();
            this.lblIssuedBy = new System.Windows.Forms.LinkLabel();
            this.lvCertProperties = new System.Windows.Forms.ListView();
            this.column1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.column2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.picVerify = new System.Windows.Forms.PictureBox();
            this.lblValidTo = new System.Windows.Forms.Label();
            this.lblValidToLabel = new System.Windows.Forms.Label();
            this.memAdditional = new System.Windows.Forms.TextBox();
            this.imgStatus = new System.Windows.Forms.PictureBox();
            this.lblValidFrom = new System.Windows.Forms.Label();
            this.lblIssuedByLabel = new System.Windows.Forms.Label();
            this.lblValidFromLabel = new System.Windows.Forms.Label();
            this.lnlIssuedToLabel = new System.Windows.Forms.Label();
            this.lblIssuedTo = new System.Windows.Forms.Label();
            this.butTip = new System.Windows.Forms.ToolTip(this.components);
            this.bPrint = new System.Windows.Forms.Button();
            this.bUnRev = new System.Windows.Forms.Button();
            this.bRev = new System.Windows.Forms.Button();
            this.bCancel = new System.Windows.Forms.Button();
            this.bSave = new System.Windows.Forms.Button();
            this.btnPublicate = new System.Windows.Forms.Button();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.picVerify)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.imgStatus)).BeginInit();
            this.SuspendLayout();
            // 
            // bCertLoad
            // 
            this.bCertLoad.Location = new System.Drawing.Point(76, 526);
            this.bCertLoad.Name = "bCertLoad";
            this.bCertLoad.Size = new System.Drawing.Size(87, 27);
            this.bCertLoad.TabIndex = 28;
            this.bCertLoad.Text = "Установить";
            this.bCertLoad.UseVisualStyleBackColor = true;
            this.bCertLoad.Visible = false;
            this.bCertLoad.Click += new System.EventHandler(this.bCertLoad_Click);
            // 
            // panel1
            // 
            this.panel1.Controls.Add(this.lblIssuedBy);
            this.panel1.Controls.Add(this.lvCertProperties);
            this.panel1.Controls.Add(this.picVerify);
            this.panel1.Controls.Add(this.lblValidTo);
            this.panel1.Controls.Add(this.lblValidToLabel);
            this.panel1.Controls.Add(this.memAdditional);
            this.panel1.Controls.Add(this.imgStatus);
            this.panel1.Controls.Add(this.lblValidFrom);
            this.panel1.Controls.Add(this.lblIssuedByLabel);
            this.panel1.Controls.Add(this.lblValidFromLabel);
            this.panel1.Controls.Add(this.lnlIssuedToLabel);
            this.panel1.Controls.Add(this.lblIssuedTo);
            this.panel1.Location = new System.Drawing.Point(14, 14);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(502, 505);
            this.panel1.TabIndex = 26;
            // 
            // lblIssuedBy
            // 
            this.lblIssuedBy.AutoSize = true;
            this.lblIssuedBy.Location = new System.Drawing.Point(147, 12);
            this.lblIssuedBy.Name = "lblIssuedBy";
            this.lblIssuedBy.Size = new System.Drawing.Size(69, 15);
            this.lblIssuedBy.TabIndex = 140;
            this.lblIssuedBy.TabStop = true;
            this.lblIssuedBy.Text = "lblIssuedBy";
            this.lblIssuedBy.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblIssuedBy_LinkClicked);
            // 
            // lvCertProperties
            // 
            this.lvCertProperties.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lvCertProperties.AutoArrange = false;
            this.lvCertProperties.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.column1,
            this.column2});
            this.lvCertProperties.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lvCertProperties.FullRowSelect = true;
            this.lvCertProperties.GridLines = true;
            this.lvCertProperties.HideSelection = false;
            this.lvCertProperties.HoverSelection = true;
            this.lvCertProperties.Location = new System.Drawing.Point(4, 101);
            this.lvCertProperties.MultiSelect = false;
            this.lvCertProperties.Name = "lvCertProperties";
            this.lvCertProperties.Size = new System.Drawing.Size(494, 324);
            this.lvCertProperties.TabIndex = 11;
            this.lvCertProperties.UseCompatibleStateImageBehavior = false;
            this.lvCertProperties.View = System.Windows.Forms.View.Details;
            this.lvCertProperties.SelectedIndexChanged += new System.EventHandler(this.lvCertProperties_SelectedIndexChanged);
            // 
            // column1
            // 
            this.column1.Text = "Поле";
            this.column1.Width = 235;
            // 
            // column2
            // 
            this.column2.Text = "Значення";
            this.column2.Width = 254;
            // 
            // picVerify
            // 
            this.picVerify.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.picVerify.Image = global::Upg.Dstu4145.CA.Arm.Properties.Resources.but_ok;
            this.picVerify.Location = new System.Drawing.Point(455, 12);
            this.picVerify.Name = "picVerify";
            this.picVerify.Size = new System.Drawing.Size(33, 29);
            this.picVerify.TabIndex = 139;
            this.picVerify.TabStop = false;
            this.butTip.SetToolTip(this.picVerify, "Підпис вірний");
            // 
            // lblValidTo
            // 
            this.lblValidTo.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblValidTo.Location = new System.Drawing.Point(314, 77);
            this.lblValidTo.Name = "lblValidTo";
            this.lblValidTo.Size = new System.Drawing.Size(163, 30);
            this.lblValidTo.TabIndex = 19;
            this.lblValidTo.Text = "01.01.2000";
            // 
            // lblValidToLabel
            // 
            this.lblValidToLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblValidToLabel.Location = new System.Drawing.Point(288, 77);
            this.lblValidToLabel.Name = "lblValidToLabel";
            this.lblValidToLabel.Size = new System.Drawing.Size(52, 30);
            this.lblValidToLabel.TabIndex = 18;
            this.lblValidToLabel.Text = "до";
            // 
            // memAdditional
            // 
            this.memAdditional.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.memAdditional.Location = new System.Drawing.Point(4, 431);
            this.memAdditional.Multiline = true;
            this.memAdditional.Name = "memAdditional";
            this.memAdditional.ReadOnly = true;
            this.memAdditional.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.memAdditional.Size = new System.Drawing.Size(494, 71);
            this.memAdditional.TabIndex = 9;
            // 
            // imgStatus
            // 
            this.imgStatus.BackgroundImage = global::Upg.Dstu4145.CA.Arm.Properties.Resources.certOk;
            this.imgStatus.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.imgStatus.Location = new System.Drawing.Point(7, 12);
            this.imgStatus.Name = "imgStatus";
            this.imgStatus.Size = new System.Drawing.Size(47, 35);
            this.imgStatus.TabIndex = 10;
            this.imgStatus.TabStop = false;
            // 
            // lblValidFrom
            // 
            this.lblValidFrom.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblValidFrom.Location = new System.Drawing.Point(147, 77);
            this.lblValidFrom.Name = "lblValidFrom";
            this.lblValidFrom.Size = new System.Drawing.Size(144, 30);
            this.lblValidFrom.TabIndex = 17;
            this.lblValidFrom.Text = "01.01.1999";
            // 
            // lblIssuedByLabel
            // 
            this.lblIssuedByLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblIssuedByLabel.Location = new System.Drawing.Point(64, 12);
            this.lblIssuedByLabel.Name = "lblIssuedByLabel";
            this.lblIssuedByLabel.Size = new System.Drawing.Size(98, 18);
            this.lblIssuedByLabel.TabIndex = 12;
            this.lblIssuedByLabel.Text = "Видавець :";
            // 
            // lblValidFromLabel
            // 
            this.lblValidFromLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblValidFromLabel.Location = new System.Drawing.Point(64, 77);
            this.lblValidFromLabel.Name = "lblValidFromLabel";
            this.lblValidFromLabel.Size = new System.Drawing.Size(120, 30);
            this.lblValidFromLabel.TabIndex = 16;
            this.lblValidFromLabel.Text = "Дійсний з";
            // 
            // lnlIssuedToLabel
            // 
            this.lnlIssuedToLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lnlIssuedToLabel.Location = new System.Drawing.Point(64, 42);
            this.lnlIssuedToLabel.Name = "lnlIssuedToLabel";
            this.lnlIssuedToLabel.Size = new System.Drawing.Size(85, 21);
            this.lnlIssuedToLabel.TabIndex = 13;
            this.lnlIssuedToLabel.Text = "Суб\'єкт : ";
            // 
            // lblIssuedTo
            // 
            this.lblIssuedTo.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblIssuedTo.Location = new System.Drawing.Point(147, 42);
            this.lblIssuedTo.Name = "lblIssuedTo";
            this.lblIssuedTo.Size = new System.Drawing.Size(301, 32);
            this.lblIssuedTo.TabIndex = 15;
            this.lblIssuedTo.Text = "lblIssuedTo";
            // 
            // bPrint
            // 
            this.bPrint.Image = ((System.Drawing.Image)(resources.GetObject("bPrint.Image")));
            this.bPrint.Location = new System.Drawing.Point(295, 532);
            this.bPrint.Name = "bPrint";
            this.bPrint.Size = new System.Drawing.Size(40, 40);
            this.bPrint.TabIndex = 32;
            this.butTip.SetToolTip(this.bPrint, "Роздрукувати сертифікат");
            this.bPrint.UseVisualStyleBackColor = true;
            this.bPrint.Click += new System.EventHandler(this.bPrint_Click);
            // 
            // bUnRev
            // 
            this.bUnRev.Image = ((System.Drawing.Image)(resources.GetObject("bUnRev.Image")));
            this.bUnRev.Location = new System.Drawing.Point(387, 532);
            this.bUnRev.Name = "bUnRev";
            this.bUnRev.Size = new System.Drawing.Size(40, 40);
            this.bUnRev.TabIndex = 31;
            this.butTip.SetToolTip(this.bUnRev, "Поновити сертифікат");
            this.bUnRev.UseVisualStyleBackColor = true;
            this.bUnRev.Visible = false;
            this.bUnRev.Click += new System.EventHandler(this.bUnRev_Click);
            // 
            // bRev
            // 
            this.bRev.Image = ((System.Drawing.Image)(resources.GetObject("bRev.Image")));
            this.bRev.Location = new System.Drawing.Point(387, 532);
            this.bRev.Name = "bRev";
            this.bRev.Size = new System.Drawing.Size(40, 40);
            this.bRev.TabIndex = 30;
            this.butTip.SetToolTip(this.bRev, "Відкликати сертифікат");
            this.bRev.UseVisualStyleBackColor = true;
            this.bRev.Visible = false;
            this.bRev.Click += new System.EventHandler(this.bRev_Click);
            // 
            // bCancel
            // 
            this.bCancel.Cursor = System.Windows.Forms.Cursors.Default;
            this.bCancel.Image = ((System.Drawing.Image)(resources.GetObject("bCancel.Image")));
            this.bCancel.Location = new System.Drawing.Point(479, 532);
            this.bCancel.Name = "bCancel";
            this.bCancel.Size = new System.Drawing.Size(40, 40);
            this.bCancel.TabIndex = 29;
            this.bCancel.Tag = "";
            this.butTip.SetToolTip(this.bCancel, "Відмінити");
            this.bCancel.UseVisualStyleBackColor = true;
            this.bCancel.Click += new System.EventHandler(this.bCancel_Click);
            // 
            // bSave
            // 
            this.bSave.Image = ((System.Drawing.Image)(resources.GetObject("bSave.Image")));
            this.bSave.Location = new System.Drawing.Point(433, 532);
            this.bSave.Name = "bSave";
            this.bSave.Size = new System.Drawing.Size(40, 40);
            this.bSave.TabIndex = 27;
            this.butTip.SetToolTip(this.bSave, "Зберігти сертифікат в файл");
            this.bSave.UseVisualStyleBackColor = true;
            this.bSave.Click += new System.EventHandler(this.bSave_Click);
            // 
            // btnPublicate
            // 
            this.btnPublicate.Location = new System.Drawing.Point(341, 532);
            this.btnPublicate.Name = "btnPublicate";
            this.btnPublicate.Size = new System.Drawing.Size(40, 40);
            this.btnPublicate.TabIndex = 32;
            this.btnPublicate.UseVisualStyleBackColor = true;
            this.btnPublicate.Visible = false;
            this.btnPublicate.Click += new System.EventHandler(this.btnPublicate_Click);
            // 
            // CertView
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
            this.ClientSize = new System.Drawing.Size(531, 584);
            this.Controls.Add(this.bPrint);
            this.Controls.Add(this.btnPublicate);
            this.Controls.Add(this.bUnRev);
            this.Controls.Add(this.bRev);
            this.Controls.Add(this.bCancel);
            this.Controls.Add(this.bCertLoad);
            this.Controls.Add(this.bSave);
            this.Controls.Add(this.panel1);
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "CertView";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Перегляд сертифікату";
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.picVerify)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.imgStatus)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button bCertLoad;
        private System.Windows.Forms.Button bSave;
        private System.Windows.Forms.Panel panel1;
        public System.Windows.Forms.Label lblValidTo;
        public System.Windows.Forms.Label lblValidToLabel;
        public System.Windows.Forms.TextBox memAdditional;
        public System.Windows.Forms.PictureBox imgStatus;
        public System.Windows.Forms.ListView lvCertProperties;
        public System.Windows.Forms.ColumnHeader column1;
        public System.Windows.Forms.ColumnHeader column2;
        public System.Windows.Forms.Label lblValidFrom;
        public System.Windows.Forms.Label lblIssuedByLabel;
        public System.Windows.Forms.Label lblValidFromLabel;
        public System.Windows.Forms.Label lnlIssuedToLabel;
        public System.Windows.Forms.Label lblIssuedTo;
        private System.Windows.Forms.Button bCancel;
        private System.Windows.Forms.ToolTip butTip;
        private System.Windows.Forms.Button bRev;
        private System.Windows.Forms.Button bUnRev;
        private System.Windows.Forms.PictureBox picVerify;
        private System.Windows.Forms.LinkLabel lblIssuedBy;
        private System.Windows.Forms.Button bPrint;
        private System.Windows.Forms.Button btnPublicate;
    }



конструкторы
Код

public CertView()
        {
            InitializeComponent();
            _presenter = new CertificateViewPresenter(this);
        }

        public CertView(long Id):this()
        {
            _presenter.ShowCertificate(Id);
        }

        public CertView(byte[] Certificate)
        //public CertView(byte[] binaryData, int status, int revReson, long ID)
        {
            InitializeComponent();
            Initialize(Certificate);
        }

PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Прежде чем создать тему, посмотрите сюда:
Partizan
PashaPash

Используйте теги [code=csharp][/code] для подсветки кода. Используйтe чекбокс "транслит" если у Вас нет русских шрифтов.
Что делать если Вам помогли, но отблагодарить помощника плюсом в репутацию Вы не можете(не хватает сообщений)? Пишите сюда, или отправляйте репорт. Поставим :)
Так же не забывайте отмечать свой вопрос решенным, если он таковым является :)


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, mr.DUDA, Partizan, PashaPash.

 
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | .NET для новичков | Следующая тема »


 




[ Время генерации скрипта: 0.0825 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.