protected void AddChild(DoctorRender render) { OrderInputRender radio = new OrderInputRender(); // radio.BackColor = Color.White; radio.Size = new System.Drawing.Size(85, 24); // radio.MouseClick += new MouseEventHandler(radio_MouseClick); radio.MenuLevel = 0; radio.Text = "常用液体"; this.AddChild(radio); OrderInputRender radio2 = new OrderInputRender(); radio2.Size = new System.Drawing.Size(85, 24); // radio2.MouseClick += new MouseEventHandler(radio_MouseClick); radio2.MenuLevel = 0; radio2.Text = "常用片剂"; OrderInputRender radio3 = new OrderInputRender(); radio3.Size = new System.Drawing.Size(85, 24); // radio3.MouseClick += new MouseEventHandler(radio_MouseClick); radio3.MenuLevel = 0; radio3.Text = "草药"; render.Add(radio); render.Add(radio2); render.Add(radio3); }
protected override void LoadData() { if (this.displayNames == null) { return; } if (this.displayNames.Count > 0) { int startY = 1; for (int i = 0; i < displayNames.Count; i++) { DoctorRender render = new DoctorRender(); render.Id = i; render.Location = new Point(0, startY); render.Size = new System.Drawing.Size(75, 24); render.SendMsg += new SendMsgHandler(render_SendMsg); render.Click += new MouseEventHandler(render_MouseClick); //在这里设定各个元素的索引值 startY = render.Bound.Bottom; render.Text = displayNames[i]; this.dropdownForm.AddRender(render); if (render.Text == "药品") { AddChild(render); } } } }
void render_SendMsg(DoctorRender sender, List <UserRender> renderlist) { int startY = 15; foreach (UserRender item in dropdownForm.RenderList) { dropdownForm.RemoveRender(item); } foreach (UserRender item in dropdownForm.OrderRenderlist) { dropdownForm.RemoveRender(item); } dropdownForm.OrderRenderlist.Clear(); dropdownForm.Twoflag = false; foreach (UserRender item in renderlist) { item.Location = new Point(76, startY); startY = item.Bound.Bottom; dropdownForm.Twoflag = true; if (item is OrderInputRender) { OrderInputRender Render = item as OrderInputRender; if (Render.IsSelect) { foreach (OrderRender userreder in Render.Items) { dropdownForm.AddRender(userreder); } } } dropdownForm.AddRender(item); } dropdownForm.Invalidate(); }