private void mapScreen_Paint(object sender, PaintEventArgs e) { var g = e.Graphics; paintBack(g); int blockWidth = formMain.Layers[0].blockWidth; int blockHeight = formMain.Layers[0].blockHeight; int scrLevelNo = getLevelRecForGameType().levelNo; int scrWidth = (int)(ConfigScript.getScreenWidth(scrLevelNo) * blockWidth * curScale); int scrHeight = (int)(ConfigScript.getScreenHeight(scrLevelNo) * blockHeight * curScale); for (int objListIndex = 0; objListIndex < objectLists.Count; objListIndex++) { var activeObjectList = objectLists[objListIndex]; var selectedRows = dgvObjects.SelectedRows; for (int i = 0; i < activeObjectList.objects.Count; i++) { var curObject = activeObjectList.objects[i]; int leftMargin = (ConfigScript.getScreenVertical() ? scrHeight : scrWidth) * curObject.sx; int topMargin = (ConfigScript.getScreenVertical() ? scrWidth : scrHeight) * curObject.sy; bool inactive = objListIndex != curActiveObjectListIndex; bool selected = !inactive && selectedRows.Cast <DataGridViewRow>().Any(r => (r.Index == i)); if (!useBigPictures) { ConfigScript.drawObject(g, curObject, curActiveObjectListIndex, selected, curScale, objectSprites, inactive, leftMargin, topMargin); } else { ConfigScript.drawObjectBig(g, curObject, curActiveObjectListIndex, selected, curScale, objectSpritesBig, inactive, leftMargin, topMargin); } } } }