public void RadioButton(Control _obj, int _selectType, int _type, int _num, bool[] _state, Point[] _location, MouseEventHandler[] _MouseClick) { SelectType = _selectType; Num = _num; State = new bool[_num]; State = _state; switch (_type) { case 0: _bmpCheck = SQK_Ui.RadioButton.RedioResource.radio1; _bmpChecked = SQK_Ui.RadioButton.RedioResource.radioed1; break; case 1: _bmpCheck = SQK_Ui.RadioButton.RedioResource.radio2; _bmpChecked = SQK_Ui.RadioButton.RedioResource.radioed2; break; case 2: _bmpCheck = SQK_Ui.RadioButton.RedioResource.radio3; _bmpChecked = SQK_Ui.RadioButton.RedioResource.radioed3; break; case 3: _bmpCheck = SQK_Ui.RadioButton.RedioResource.radio4; _bmpChecked = SQK_Ui.RadioButton.RedioResource.radioed4; break; case 4: _bmpCheck = SQK_Ui.RadioButton.RedioResource.radio5; _bmpChecked = SQK_Ui.RadioButton.RedioResource.radioed5; break; default: break; } radio = new UiControlsMethod.PictureBoxEx[_num]; for (int i = 0; i < _num; i++) { radio[i] = new UiControlsMethod.PictureBoxEx(); radio[i].BackColor = Color.Transparent; radio[i].Cursor = Cursors.Hand; radio[i].Size = _bmpCheck.Size; radio[i].Location = _location[i]; radio[i].Tag = i; radio[i].Click += new EventHandler(_Click); radio[i].MouseClick += _MouseClick[i]; if (_state[i]) { radio[i].Image = _bmpChecked; } else { radio[i].Image = _bmpCheck; } _obj.Controls.Add(radio[i]); } }
private void _ImgMouseLeave(object sender, EventArgs e) { UiControlsMethod.PictureBoxEx Lg = (UiControlsMethod.PictureBoxEx)sender; Lg.BackColor = _leaveColor; Bitmap bmp_item = new Bitmap(Lg.Width, Lg.Height); Graphics gItem = Graphics.FromImage(bmp_item); gItem.DrawImage(_dropItemList[(int)Lg.Parent.Tag]._bmpItem, _bmpItemXY); UiDrawTextMethod _ds = new UiDrawTextMethod(); _ds.DrawString(bmp_item, _dropItemList[(int)Lg.Parent.Tag]._string, _fnt, _fntcolor, new Rectangle(_stringItemXY, bmp_item.Size)); Lg.Image = bmp_item; Lg.Update(); }
private void _Click(object sender, EventArgs e) { UiControlsMethod.PictureBoxEx pL = (UiControlsMethod.PictureBoxEx)sender; if (State) { State = false; pL.Image = _bmpCheck; } else { State = true; pL.Image = _bmpChecked; } pL.Update(); }
public void CheckBox(Control _obj, int _type, bool _state, Point _location, MouseEventHandler _MouseClick) { State = _state; switch (_type) { case 0: _bmpCheck = SQK_Ui.CheckBox.CheckResource.chk1; _bmpChecked = SQK_Ui.CheckBox.CheckResource.chked1; break; case 1: _bmpCheck = SQK_Ui.CheckBox.CheckResource.chk2; _bmpChecked = SQK_Ui.CheckBox.CheckResource.chked2; break; case 2: _bmpCheck = SQK_Ui.CheckBox.CheckResource.chk3; _bmpChecked = SQK_Ui.CheckBox.CheckResource.chked3; break; default: _bmpCheck = SQK_Ui.CheckBox.CheckResource.chk1; _bmpChecked = SQK_Ui.CheckBox.CheckResource.chked1; break; } UiControlsMethod.PictureBoxEx check = new UiControlsMethod.PictureBoxEx(); check.BackColor = Color.Transparent; check.Cursor = Cursors.Hand; check.Size = _bmpCheck.Size; check.Location = _location; if (_state) { check.Image = _bmpChecked; } else { check.Image = _bmpCheck; } check.Click += new EventHandler(_Click); check.MouseClick += _MouseClick; _obj.Controls.Add(check); }
private void _Click(object sender, EventArgs e) { UiControlsMethod.PictureBoxEx pL = (UiControlsMethod.PictureBoxEx)sender; if (SelectType == 0) //single-select { for (int i = 0; i < Num; i++) { if (i != (int)pL.Tag) { radio[i].Image = _bmpCheck; State[i] = false; } else { radio[i].Image = _bmpChecked; State[i] = true; } radio[i].Update(); } } else if (SelectType == 1) //multi-select { if (State[(int)pL.Tag] == true) { State[(int)pL.Tag] = false; radio[(int)pL.Tag].Image = _bmpCheck; } else { State[(int)pL.Tag] = true; radio[(int)pL.Tag].Image = _bmpChecked; } radio[(int)pL.Tag].Update(); } }
public void add_dropItemList( int _type, Size panelSize, Bitmap bmpItem, Point bmpItemXY, string stringItem, Point stringItemXY, Font fnt, Color fnt_color, Color _selectBkColor, Bitmap select_bmpItem, Color select_fntcolor ) { switch (_type) { case 0: backcolor = Color.FromArgb(246, 246, 246); break; case 1: backcolor = Color.FromArgb(40, 45, 52); break; case 2: backcolor = Color.FromArgb(239, 238, 238); break; case 3: backcolor = Color.FromArgb(52, 73, 94); break; default: backcolor = Color.FromArgb(246, 246, 246); break; } _moveColor = _selectBkColor; _leaveColor = backcolor; _select_fntcolor = select_fntcolor; _bmpItemXY = bmpItemXY; _stringItem = stringItem; _stringItemXY = stringItemXY; _fnt = fnt; _fntcolor = fnt_color; UiControlsMethod.PanelEx _panel = new UiControlsMethod.PanelEx(); UiControlsMethod.PictureBoxEx _itemImage = new UiControlsMethod.PictureBoxEx(); _panel.Size = panelSize; _panel.BackColor = Color.Transparent; Bitmap bmp_item = new Bitmap(panelSize.Width, panelSize.Height); Graphics gItem = Graphics.FromImage(bmp_item); gItem.DrawImage(bmpItem, bmpItemXY); UiDrawTextMethod _ds = new UiDrawTextMethod(); _ds.DrawString(bmp_item, stringItem, fnt, fnt_color, new Rectangle(stringItemXY, panelSize)); _itemImage.BackColor = backcolor; _itemImage.Size = panelSize; _itemImage.Image = bmp_item; _itemImage.Location = new Point(0, 0); _itemImage.MouseMove += new MouseEventHandler(_ImgMouseMove); _itemImage.MouseLeave += new EventHandler(_ImgMouseLeave); _itemImage.Click += new EventHandler(_ImgClick); _panel.Controls.Add(_itemImage); _dropItemList.Add(new dropItem { item_font = fnt, dropItemPanel = _panel, _string = stringItem, _bmpItem = bmpItem, _select_bmpItem = select_bmpItem } ); }
private void _ImgClick(object sender, EventArgs e) { UiControlsMethod.PictureBoxEx Lg = (UiControlsMethod.PictureBoxEx)sender; _uInput.Value = _dropItemList[(int)Lg.Parent.Tag]._string; DropListHidden(); }
public void InitializeStyleButton( Control _obj, int _type, int _width, Bitmap _bmp, Point _bmplocation, Font fnt, string _string, Color _stringcolor, Rectangle _stringrec, Point _location, MouseEventHandler _click ) { Bitmap _BmpBlock; int[] cutImg; //cut image left,middle, right width; switch (_type) { case 0: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn1; cutImg = new int[3] { 40, 1, 10 }; break; case 1: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn2; cutImg = new int[3] { 40, 1, 10 }; break; case 2: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn3; cutImg = new int[3] { 40, 1, 10 }; break; case 3: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn4; cutImg = new int[3] { 40, 1, 10 }; break; case 4: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn5; cutImg = new int[3] { 40, 1, 10 }; break; case 5: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn6; cutImg = new int[3] { 40, 1, 10 }; break; case 6: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn7; cutImg = new int[3] { 40, 1, 10 }; break; case 7: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn8; cutImg = new int[3] { 40, 1, 10 }; break; case 8: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn9; cutImg = new int[3] { 40, 1, 10 }; break; case 9: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn10; cutImg = new int[3] { 40, 1, 10 }; break; case 10: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn11; cutImg = new int[3] { 10, 1, 10 }; break; case 11: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn12; cutImg = new int[3] { 10, 1, 10 }; break; case 12: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn13; cutImg = new int[3] { 3, 1, 3 }; break; case 13: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn14; cutImg = new int[3] { 3, 1, 3 }; break; case 14: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn15; cutImg = new int[3] { 45, 1, 12 }; break; case 15: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn16; cutImg = new int[3] { 45, 1, 12 }; break; case 16: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn17; cutImg = new int[3] { 45, 1, 12 }; break; case 17: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn18; cutImg = new int[3] { 45, 1, 12 }; break; case 18: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn19; cutImg = new int[3] { 45, 1, 12 }; break; case 19: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn20; cutImg = new int[3] { 45, 1, 12 }; break; case 20: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn21; cutImg = new int[3] { 45, 1, 12 }; break; case 21: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn22; cutImg = new int[3] { 45, 1, 12 }; break; default: _BmpBlock = SQK_Ui.StyleButton.StyleButtonResource.s_btn1; cutImg = new int[3] { 40, 1, 10 }; break; } Bitmap sep_Left = _BmpBlock.Clone(new Rectangle(0, 0, cutImg[0], _BmpBlock.Height), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); Bitmap sep_Middle = _BmpBlock.Clone(new Rectangle(cutImg[0], 0, cutImg[1], _BmpBlock.Height), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); Bitmap sep_Right = _BmpBlock.Clone(new Rectangle(_BmpBlock.Width - cutImg[2], 0, cutImg[2], _BmpBlock.Height), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); Bitmap bmpBtn = new Bitmap(cutImg[0] + _width + cutImg[2], _BmpBlock.Height); Graphics btnImg = Graphics.FromImage(bmpBtn); btnImg.DrawImage(sep_Left, 0, 0); for (int i = 0; i < _width; i++) { btnImg.DrawImage(sep_Middle, cutImg[0] + i, 0); } btnImg.DrawImage(sep_Right, cutImg[0] + _width, 0); btnImg.DrawImage(_bmp, _bmplocation); UiDrawTextMethod ds = new UiDrawTextMethod(); ds.DrawString(bmpBtn, _string, fnt, _stringcolor, _stringrec); UiControlsMethod.PictureBoxEx sbtn = new UiControlsMethod.PictureBoxEx(); sbtn.BackColor = Color.Transparent; sbtn.Size = new Size(cutImg[0] + _width + cutImg[2], _BmpBlock.Height); sbtn.Location = _location; sbtn.Image = bmpBtn; sbtn.MouseClick += _click; _obj.Controls.Add(sbtn); }
public void InitializeSwitchEffect(Control _obj, Point origin, int _flag, int switchType, int speed, MouseEventHandler _click) { firstBmp = SQK_Ui.switchButton.switchResource.switch1_a; secondBmp = SQK_Ui.switchButton.switchResource.switch1_b; _origin = origin; _speed = speed; switch_flag = _flag; switch (switchType) { case 0: firstBmp = SQK_Ui.switchButton.switchResource.switch1_a; secondBmp = SQK_Ui.switchButton.switchResource.switch1_b; break; case 1: firstBmp = SQK_Ui.switchButton.switchResource.switch2_a; secondBmp = SQK_Ui.switchButton.switchResource.switch2_b; break; case 2: firstBmp = SQK_Ui.switchButton.switchResource.switch3_a; secondBmp = SQK_Ui.switchButton.switchResource.switch3_b; break; default: break; } _w = firstBmp.Width; _h = firstBmp.Height; Point lc = new Point(0, 0); cube = new Cube(_w, _h, 1); for (int i = 0; i < 90; i++) { cube.RotateY = i * 2; cube.calcCube(lc); corners[i, 0] = cube.d; corners[i, 1] = cube.a; corners[i, 2] = cube.c; corners[i, 3] = cube.b; int t = 0; if ((corners[i, 0].X - corners[i, 1].X) <= 1) { if (corners[i, 0].Y < corners[i, 1].Y) { t = corners[i, 0].Y; } else { t = corners[i, 1].Y; } set[i] = new PointF(corners[i, 0].X + _w / 2, t + _h / 2); } else { if (corners[i, 1].Y < corners[i, 0].Y) { t = corners[i, 1].Y; } else { t = corners[i, 0].Y; } set[i] = new PointF(corners[i, 1].X + _w / 2, t + _h / 2); } begin[i] = false; filters[i] = new FreeTransform(); if (i < 45) { filters[i].Bitmap = firstBmp; } else { filters[i].Bitmap = secondBmp; } } Parallel.For(0, 90, (i) => { updateImage(i); }); switchPanel = new UiControlsMethod.PanelEx(); switchPanel.Size = new Size(_w, _h); switchPanel.Location = origin; switchPanel.BackColor = Color.Transparent; picSwitch = new UiControlsMethod.PictureBoxEx(); picSwitch.BackColor = Color.Transparent; picSwitch.Size = new Size(_w, _h); picSwitch.Location = new Point(0, 0); if (_flag == 0) { picSwitch.Image = firstBmp; } else { picSwitch.Image = secondBmp; } picSwitch.Click += new EventHandler(picSwitch_Click); picSwitch.MouseClick += _click; picSwitch.Cursor = Cursors.Hand; switchPanel.Controls.Add(picSwitch); _obj.Controls.Add(switchPanel); }