private void updateName() { if (lab_Up_Name.InvokeRequired) { lab_Up_Name.Invoke(new Name_Update(updateName), new object[] { }); } else if (lab_Right_Name.InvokeRequired) { lab_Right_Name.Invoke(new Name_Update(updateName), new object[] { }); } else if (lab_Down_Name.InvokeRequired) { lab_Down_Name.Invoke(new Name_Update(updateName), new object[] { }); } else if (lab_Left_Name.InvokeRequired) { lab_Left_Name.Invoke(new Name_Update(updateName), new object[] { }); } else { lab_Up_Name.Text = all.Name[place.getRealPlace_Up].ToString(); lab_Right_Name.Text = all.Name[place.getRealPlace_Right].ToString(); lab_Down_Name.Text = all.Name[place.getRealPlace_Down].ToString(); lab_Left_Name.Text = all.Name[place.getRealPlace_Left].ToString(); pic_Up.Image = ResourcesTool.getImage(lab_Up_Name.Text); pic_Right.Image = ResourcesTool.getImage(lab_Right_Name.Text); pic_Down.Image = ResourcesTool.getImage(lab_Down_Name.Text); pic_Left.Image = ResourcesTool.getImage(lab_Left_Name.Text); } }
void addimage_to_FlowLayout(FlowLayoutPanel flow, BrandPlayer player, EventHandler ev) { for (int i = 0; i < player.getCount(); i++) { Bitmap bitmap = new Bitmap(ResourcesTool.getImage(player.getBrand(i))); BrandBox b = new BrandBox(player.getBrand(i)); b.SizeMode = PictureBoxSizeMode.AutoSize; bitmap = ResizeBitmap(bitmap, Mahjong.Properties.Settings.Default.ResizePercentage); b.Click += ev; b.Image = bitmap; flow.Controls.Add(b); } }
protected virtual void addimage(location state, Brand brand, RotateFlipType rotate) { Bitmap bitmap; // 如果是可視的牌就設定顯示牌的圖型,否則就顯示直立的牌 Resources.upbarnd if (brand.IsCanSee || state == location.South || ShowAll) { bitmap = new Bitmap(ResourcesTool.getImage(brand)); } else { bitmap = new Bitmap(Resources.upbarnd); } // 設定牌 BrandBox tempBrandbox = new BrandBox(brand); // 設定自動縮放 tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize; // 設定邊距 tempBrandbox.Margin = new Padding(0); tempBrandbox.Padding = new Padding(padding); // 要轉的角度 bitmap.RotateFlip(rotate); // 提示 if (ShowAll && ShowBrandInfo) { tempBrandbox.Click += new EventHandler(debug_Click); } // 滑鼠事件 if ( state == location.South && brand.getClass() != Settings.Default.Flower && brand.Team < 1 ) { tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove); tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave); tempBrandbox.Click += new EventHandler(brandBox_MouseClick); // 作弊事件 //if (ShowAll && ShowBrandInfo) // tempBrandbox.MouseHover += new EventHandler(debug_Click); //else // tempBrandbox.MouseHover -= new EventHandler(debug_Click); } else if (brand.Team >= 1) { tempBrandbox.BackColor = Color.DarkGreen; } else if (cheat && state != location.South) { tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick); } else { tempBrandbox.Click -= new EventHandler(brandBox_MouseClick); tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick); } bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage); // 設定圖片 tempBrandbox.Image = bitmap; // 新增至控制項 add_flowLayoutBrands(state, tempBrandbox); }